AlpacaZorroPlugin v1.1.0 Released

Posted By: kzhao

AlpacaZorroPlugin v1.1.0 Released - 09/20/21 14:37

https://github.com/kzhdev/alpaca_zorro_plugin/releases/tag/v1.1.0
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 09/21/21 14:12

Hi @kzhao,

This will be a bit vague in case it's a known issue (or somehow my fault laugh ) so we don't waste a lot of time. A script fails to subscribe and download prices over REST for assets 2+ giving Zorro Error 054 - invalid price. Changing only to Websocket the script works. Is this expected?

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 09/21/21 15:37

@DdlV

I have seen Error 054 as well. I believe it was caused by an empty market. If you set LogLevel=6, you will see that the ask price/size, is 0 in the snapshot response.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 09/22/21 19:09

@kzhao,

Error 054: Maybe... It seems to only happen on the 1st asset... And maybe only in Trade, not Test... Processing seems to continue without a problem...

Prices download (EOD): LogLevel=6 is showing multiple downloads for each asset:

- The requested date range, possibly shortened by Alpaca (with a Basic data plan message)
- A reduced date range beginning with the requested start date and ending with a different date - don't know where the latter comes from
- 2 or more additional download (attempts) beginning with the requested start date and ending days later, each time decreasing by 1 day and returning 0 bars

Is this expected?

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 09/23/21 21:42

@DdlV

Error 054 won't happen in Test mode because in Test mode Zorro doesn't request market data from Broker.

For the download:
1. The plugin adjusts the end time to 15 minutes prior to now (the DateTime when the function is called) otherwise Alpaca will reject the request. Alpaca might shorten the range if there is not enough data available on their end.
2. Ending date changes because Zorro only requests a limited number of bars. After the plugin returned the bars, Zorro often sends another request with the same start date and different end data.
3. When there are no more data available within the given range, 0 bars are turned to Zorro. Zorro often sends a couple of more requests with the end date decreasing by 1, I think that is Zorro’s way to make sure no data are missing.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 09/24/21 12:05

Thanks @kzhao!

Error 054: I will let you know if it happens in Test (since I am getting (History) data in Test); and if it causes a problem in Trade.

Download:
1. Not sure what 15 mins has to do with EOD data. laugh Yes, I have seen the Alpaca adjust start date messages.
2. I saw request for, say, 2016 to today (2021) all successfully downloaded, followed by a request for 2016 to (sometime in) 2017, also successfully downloaded. Not sure why - seems a waste of bandwidth. But from what you say it's Zorro's issue, not yours.
3. Yes, this is what I see; except "couple of more" seems to vary from 2 to 5+ tries - no idea why, but also Zorro's issue.

Thanks.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 09/29/21 07:55

@kzhao,

Alpaca Historical EOD data does not appear to be split-adjusted (nor dividend-adjusted?). Is there a setting I'm missing or some other way to get adjusted Historical EOD data?

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 09/29/21 12:50

Alpaca doesn't provide adjusted data at the moment. I heard the adjusted data is coming soon.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 09/29/21 16:09

@kzhao,

Ah... The infamous "soon"! laugh

I thought I'd read something like that, but couldn't find it...

Oh well... Now to try to figure out what best to do until when/if "soon" arrives...

Thanks.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 11/01/21 21:13

Hi @kzhao,

Code
brokerCommand(2001, char *symbols);


Will generate a csv of all the Assets in *symbols.

Is there an easy/quick way to get only the Assets in *symbols that have some minimum amount of History data available?

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 11/01/21 21:51

@DdlV You can use the Download script. In the first input box, replace the Symbol with the generated asset file name (without the .csv)
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 11/02/21 18:40

Thanks @kzhao. But I don't understand. How does this help create a subset csv containing only those Assets with <n> History values?

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 11/03/21 02:03

@DdlV I see. I misunderstood your question. Do you want to create a .csv file containing the history values of all the symbols in *symbols? I'm afraid Zorro doesn't provide this functionality. But you can use the ZHistoryEditor (http://server.conitec.net/down/ZHistoryEditor.zip) to create .csv file for each symbol from the .t6 file then combine them to a single .csv. Hopefully, this helps.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 11/03/21 06:36

Thanks @kzhao. Sorry for not being clear. I'm looking for a way to query "How much History does this Asset have?" without actually downloading the History at that time.

Example scenario: I get a list of Assets (stocks and/or ETFs) for some sector. I'd like to quickly prune the list, eliminating any Assets that don't have whatever I consider to be enough History. I.e., I don't want to waste the time downloading what won't be enough History for Assets that I won't consider further.

Thanks.
Posted By: AndrewAMD

Re: AlpacaZorroPlugin v1.1.0 Released - 11/03/21 13:21

Originally Posted by DdlV
Thanks @kzhao. Sorry for not being clear. I'm looking for a way to query "How much History does this Asset have?" without actually downloading the History at that time.
I know zero broker API's that give you this information. grin Really, the only way to know this is to download historical data.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 11/03/21 14:24

@DdlV

As @AndresAMD said, Alpaca doesn't provide any API to give you this information.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 11/03/21 18:23

Thanks @AndrewAMD, @kzhao.

I didn't expect, but I hoped... laugh

Oh well, off to devise yet another workaround...

Thanks.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 11/09/21 18:53

Hi @kzhao,

I'm not sure if this is a plugin or Zorro issue... Very occasionally (like 1x/mo at most) when I'm downloading prices and there is an extended or more severe Internet outage, Zorro will hang hard. The message window stops updating, clicking Stop does nothing, and clicking Close does nothing. I have to kill Zorro completely. Have you seen this? Or is it a Zorro issue? Or Windows? laugh

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 11/09/21 19:34

@DdlV Hmm, I haven't seen this yet. Not sure if it is a Zorro or plugin issue. Both are possible. I'll keep an eye on this. If you have a log with the log level set to 6, that could be helpful.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 11/11/21 17:34

@kzhao,

Have set log level 6. Will let you know what it shows when/if happens again.

Another question: If I use

Code
brokerCommand(2001, 0);


to get a csv of all symbols, is there an easy way to tell what's what? Stock, ETF, or other attributes?

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 11/11/21 18:58

@DdIV Unfortunately, there is no easy way to tell what is the type of the asset. Assets returned from Alpaca API all have the "us_equity" class. The only way to distinguish Stock, ETF is from the name field, but the name field doesn't fit into the asset.csv file.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 11/11/21 19:22

Thanks @kzhao. Unfortunately, that confirms what I thought. frown

3 ideas for consideration:

  • Does the csv file ignore extra fields at the end of each line?
  • Does the csv file support "#" comments at the end of each line?
  • Perhaps also create a companion AssetsAlpaca[Paper]Name file?


Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 11/12/21 01:48

@jcl Is that OK to include a custom column in the AssetList.csv file?
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 11/15/21 16:01

@DdIV I ran some tests. It seems fine to have a custom column in the AssetList.csv. I can add it in the next release.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.1.0 Released - 11/15/21 17:21

Thanks @kzhao!

Would it be better as a custom column, or as a "#" comment at the end of the line? (In case @jcl & crew decide to add more columns...)
Posted By: kzhao

Re: AlpacaZorroPlugin v1.1.0 Released - 11/15/21 19:47

@DdIV I think it is better to add a custom column. The CSV standard doesn't have a comment.
© 2024 lite-C Forums