3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Creating/using a synthetic asset
#485140
01/27/22 01:06
01/27/22 01:06
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
I would like to create several synthetic assets, say, a Dollar index, Euro index, etc - and do so as: assetAdd("USD");
var prc;
while(asset(of("EUR/USD", "GBP/USD", "AUD/USD")) {
prc+=priceC();
}
asset("USD");
priceSet(0, prc, prc,prc,prc); This - as is - doesn't work, as Zorro requires some valid price history for "USD" (zero-length files or using #USD are not useful). So, 2 questions: 1) is there a way to create such 'assets' on the fly without having to pre-generate some dummy t6 files? (and if not at the moment - can such a way be provided) 2) how to avoid such synthetic 'assets' being 'subscribed to' by Zorro in Live trading? Thank you.
|
|
|
Re: Creating/using a synthetic asset
[Re: Zheka]
#485155
01/29/22 12:13
01/29/22 12:13
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
This is mentioned in the manual and I tried it. Unfortunately, priceSet() will then not work. @Spirit: !!EUR/USD does not work. Probably a bug because EUR/USD!! correctly recognizes SymbolTrade as EUR/USD and ! EUR/USD ! correctly gives SymbolLive as EUR/USD, but with !!EUR/USD - all 3 Symbolxx are just USD. Also: Symbol - Symbol(s) of the asset. Up to 3 sources and symbols can be entered for trading, live prices, and historical prices, separated by '!' exclamation marks (!trade!live!history). seems incorrect: there should be no ! prior to the very first symbol If several symbols are used and one of them is blank or empty (f.i. "AAPL! !"), the prices of that asset are not downloaded or retrieved from the broker. This can be used in special cases when no market data was subscribed or prices are retrieved by other means, f.i. with the assetHistory or priceQuote functions. So, is it several or one (as in the example)?
|
|
|
Re: Creating/using a synthetic asset
[Re: Zheka]
#485156
01/29/22 13:56
01/29/22 13:56
|
Joined: Apr 2008
Posts: 586 Austria
Petra
Support
|
Support
Joined: Apr 2008
Posts: 586
Austria
|
A symbol "!!EUR/USD" will not trade, not get live prices, and get "EUR/USD" history from the broker. Look here: https://manual.zorro-project.com/symbol.htmSymbols are for brokers in live trading. Not for files on your PC. That has maybe confused you? The history files on your PC are always expected with the asset name. There is no extra symbol for "PC file names". priceSet cannot work when an asset has no history because its purpose is to store prices in the history. What you probably need is a dummy asset, like asset(""). A dummy asset has a history filled with default prices. You can then overwrite them. Look in the manual, there was an example of dummy assets for the "genSine" function for artificial price curves.
|
|
|
Re: Creating/using a synthetic asset
[Re: Zheka]
#485157
01/29/22 15:51
01/29/22 15:51
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
Ah, ok, i see (but !!EUR/USD still does not set SymbolHist to EUR/USD).
There can only be one 'dummy' asset, and I would like to have 5-6 'indices', for majors...Such capability should come very handy for creating bespoke stock sectors, indicators,etc.
Last edited by Zheka; 01/29/22 16:00.
|
|
|
Re: Creating/using a synthetic asset
[Re: Zheka]
#485165
01/30/22 16:42
01/30/22 16:42
|
Joined: Jul 2017
Posts: 785
Zheka
OP
User
|
OP
User
Joined: Jul 2017
Posts: 785
|
"#name" does seem to be documented: asset(): Name - The name of the asset, as in the asset list or the [Asset] selector. An empty string "" creates a dummy asset, a name beginning with '#' prevents loading price history. Asset Lists: The asset is ignored when the name begins with a hash character "#". This also requires a clarification: If several symbols are used and one of them is blank or empty (f.i. "AAPL! !"), the prices of that asset are not downloaded or retrieved from the broker. (..is it one or several??)
Last edited by Zheka; 01/30/22 16:49.
|
|
|
|