Iterating CSV files to determine ticker and date to download intraday data

Is it possible to use AmiQuote to load data based on data in a CSV? In other words, I have a bunch of CSV files that look like:

File 1:

,Size,EntryBar,ExitBar,EntryPrice,ExitPrice,PnL,ReturnPct,EntryTime,ExitTime,StopLoss,TakeProfit,Duration,strategy_name,strategy_rule_set,ticker

0,1000,39,40,1.0,0.99,-10.000000000000009,-0.010000000000000009,1994-06-01,1994-06-02,0.74,0.0,1 days,WedgePop_EMA20_Trailing_StopLoss_Up_to_10B_Cap_,Exit_After_3_Days_Or_10EMA,CPSH

1,1135,56,57,0.88,0.87,-11.35000000000001,-0.011363636363636354,1994-06-24,1994-06-27,0.8,0.0,3 days,WedgePop_EMA20_Trailing_StopLoss_Up_to_10B_Cap_,Exit_After_3_Days_Or_10EMA,CPSH

File 2:

,Size,EntryBar,ExitBar,EntryPrice,ExitPrice,PnL,ReturnPct,EntryTime,ExitTime,StopLoss,TakeProfit,Duration,strategy_name,strategy_rule_set,ticker

0,43,22,25,22.75,23.38,27.089999999999957,0.027692307692307683,1993-08-23,1993-08-26,22.11,0.0,3 days,WedgePop_EMA20_Trailing_StopLoss_Up_to_10B_Cap_,Exit_After_3_Days_Or_10EMA,CPT

1,38,72,73,26.12,26.0,-4.560000000000038,-0.004594180704441064,1993-11-02,1993-11-03,25.869999999999997,0.0,1 days,WedgePop_EMA20_Trailing_StopLoss_Up_to_10B_Cap_,Exit_After_3_Days_Or_10EMA,CPT

I'd like to be able to iterate through the files within a given directory and load the 1-minute data for each ticker + date combination. Even better would be to combine ranges of dates, but I'd settle for the first step.

Thank you!

Hello buywall,
your CSVs seem to contain information related to trades, but (according to the developer home page - LINK - ) AmiQuote is a software written for importing financial data such as price timeseries etc... into the AB's database.

As far as I know, if you need to import such trade lists you should write a kind of file reading tool using AFL.

As always, original poster did not describe THE GOAL. Unfortunately your question isn't clear enough and does not provide all necessary details to give you an answer. Please follow this advice: How to ask a good question

Having said that, guessing from content of the file, you might find this KB article useful:

My apologies for the poorly structured question.

Yes, the data is trade data, but I'm not looking to use that data in Amibroker to stats. My goal is to be able to read that data and use the EntryTime as the from_ymd in Amiquote to set the From parameter and set the To (to_ymd) based on whatever the possible max is (I'd calc this in code after figuring it out - IIRC, it's 10k bars) to download intraday data.

Just to 'tag base' and see if this can be done, I've tried the following. If I find I can do something like this, I'd loop in the values, but what I really want to do is spin this up within AmiQuote, if possible:

# Set the path to the Amiquote executable
amiquote_path = "C:\\Program Files\\AmiBroker\\AmiQuote\\Quote.exe"

# Set the command-line arguments for the Amiquote command
args = ["-data-format=CommaSeparatedValues", "-url=https://financialmodelingprep.com/intraday-prices/AAPL", "-data-range=2022-01-01,2022-01-01?apikey=abc123"]

# Run the Amiquote command
subprocess.run([amiquote_path] + args)

and:

# Set the path to the Amiquote executable
amiquote_path = "C:\\Program Files\\AmiBroker\\AmiQuote\\Quote.exe"

# Set the command-line arguments for the Amiquote command
args = ["-data-format=CommaSeparatedValues", "-url=https://financialmodelingprep.com/intraday-prices/{TICKER}", "-data-range={DATE},{DATE}?apikey=abc12"]

# Create a list of tickers and dates
tickers = ["AAPL", "MSFT", "GOOG"]
dates = ["2022-01-01", "2022-01-02", "2022-01-03"]

# Run the Amiquote command and pass the tickers and dates as input
p = subprocess.run([amiquote_path] + args, input="\n".join(tickers + dates), text=True, capture_output=True)

# Print the output from the Amiquote command
print(p.stdout)

When I attempt this approach, AmiQuote spawns, but doesn't react.

I haven't see a way to run AFL in AmiQuote, so there's nothing to show from that end of things and the Javascript tab in AmiQuote appears to be for transformations.

  • Thank you

I don't know from where you got that code, but arguments used are complete fantasy and hallucination (maybe AI wrote that because it hallucinates very often).

Actual arguments that AmiQuote uses are listed in ReadMe2.html file and they are anywhere near to what you have in this pseudo-code

AmiQuote is not really "command line" program. If is full GUI program. For command-line downloader, use WGET

https://www.gnu.org/software/wget/