AlpacaZorroPlugin v1.2.0 Released

Posted By: kzhao

AlpacaZorroPlugin v1.2.0 Released - 11/15/21 20:08

https://github.com/kzhdev/alpaca_zorro_plugin/releases/tag/v1.2.0

v1.2.0

- Added AlpacaBrokerCommands.h header file.
- Added fractional qty support
* Added AlpacaFractionalLotAmount config. Set this config will modify the LotAmount of a fractionable asset. For example: with AlpacaFractionalLotAmount = 0.0001 in the Zorro.ini or ZorroFix.ini, enterLong(1) places bid of 0.0001 shares of a fractionable asset
* Use BrokerCommand(IS_ASSET_FRACTIONABLE, Asset) to check if current Asset is fractionable. (Need to include AlpacaBorkerCommands.h in the strategy)
- Fix MOC and MOO order can't open error.
- Added IS_ASSERET_FRACTIONABLE, IS_ASSET_SHORABLE, IS_ASSET_EASY_TO_BORROW, IS_ASSET_MARGINABLE custom broker commands
- Added a Description column in the generated AssetList.csv
Posted By: DdlV

Re: AlpacaZorroPlugin v1.2.0 Released - 11/16/21 17:50

Thanks @kzhao!

One comment: For most of Zorro, the Assets.csv ends with Symbol. However, for the Z9 strategy, one other Type field is added. Perhaps the AssetsAlpaca.csv file should include this Type field (set to 0, probably) between Symbol and Description?

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.2.0 Released - 11/16/21 18:43

@DdIV Sure, I can add the Type field. I can't find anywhere mentioned the Type field in the AssetList. Is the Type field used by the assetType(string Name) int function?
Posted By: AndrewAMD

Re: AlpacaZorroPlugin v1.2.0 Released - 11/16/21 19:31

Type is not a standard Asset list field, it is custom. The extra columns are routed into an AssetVar or AssetStr. Z9 then uses it specifically for that strategy.
https://zorro-project.com/manual/en/account.htm
https://zorro-trader.com/manual/en/algovar.htm
https://zorro-project.com/manual/en/zsystems.htm
Originally Posted by kzhao
Is the Type field used by the assetType(string Name) int function?
No. All that function does is interpret the Asset name.
https://zorro-trader.com/manual/en/asset.htm
Posted By: DdlV

Re: AlpacaZorroPlugin v1.2.0 Released - 11/16/21 22:27

Thanks for the clarifications & references, @AndrewAMD!

@kzhao, given that Type is used by an official Z Strategy, it would still seem to make sense to include it so the generated Asset list would apply to all known official Zorro strategies?

Thanks.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.2.0 Released - 11/16/21 22:41

@kzhao, also with the recent Zorro change, Leverage is not used. Plugging 1 is probably OK, but should also plug -100 into MarginCost?

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.2.0 Released - 11/17/21 00:20

@AndrewAMD Thanks the information
Posted By: kzhao

Re: AlpacaZorroPlugin v1.2.0 Released - 11/17/21 00:44

@DdIV Yeah, I can add the MarginCost column
Posted By: kzhao

Re: AlpacaZorroPlugin v1.2.0 Released - 11/17/21 18:14

@DdIV The changes are released.

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

Re: AlpacaZorroPlugin v1.2.0 Released - 11/23/21 09:51

Thanks @kzhao!
Posted By: DdlV

Re: AlpacaZorroPlugin v1.2.0 Released - 11/30/21 19:43

Hi @kzhao,

Question re. order text. The docs say

Code
// Use borkderCommand(SET_ORDERTEXT, xxxx) to set a custom order text
brokerCommand(SET_ORDERTEXT, "MyAlpacaOrder");  // "MyAlpacaOrder" will be added into ClientOrderId
enterLong(5);


Is there a default for order text? Rather than having to explicitly set it each time, a good default might be "<strategy>-<algo>"?

Thanks.
Posted By: AndrewAMD

Re: AlpacaZorroPlugin v1.2.0 Released - 11/30/21 19:54

Originally Posted by DdlV
a good default might be "<strategy>-<algo>"?
This is impossible because the broker plugin does not have access to this information. The script writer has access to this information and can set it via brokercommand.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.2.0 Released - 11/30/21 22:30

As @AndrewAMD said, the plugin doesn't know anything about the strategy.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.2.0 Released - 12/01/21 18:04

Thanks @AndrewAMD, @kzhao. Obviously I'm not a plugin writer. laugh Just a lazy scripter... laugh laugh
Posted By: DdlV

Re: AlpacaZorroPlugin v1.2.0 Released - 06/06/22 19:56

Hi @kzhao,

How time flies! Hope you are well.

A new question: In the generated AssetsAlpaca.csv, how is Spread determined? Some Assets are getting huge Spreads...

Thanks.
Posted By: kzhao

Re: AlpacaZorroPlugin v1.2.0 Released - 06/07/22 01:44

Hi DdIV, The spread is the ask price - bid price (lastQuote.ap - lastQuote.bp). For illiquid assets, the spread might be huge.
Posted By: DdlV

Re: AlpacaZorroPlugin v1.2.0 Released - 06/07/22 07:11

Thanks @kzhao.

If I understand you correctly, it's from whatever is the lastQuote existing at the time the brokerCommand(CREATE_ASSETLIST, ...) is run. So, in addition to illiquid assets, it could also be due to "outliers" at the end of trading session if the AssetsAlpaca.csv is created, say, on the weekend?

Is there an easy way to get a more realistic Spread?

Or am I stuck with just plugging a % of Price; or 0?

Thanks.
© 2024 lite-C Forums