Open loopiezlol opened 2 years ago
Seems that playing with the PIP together with the LotAmount variable in the assets list changes the behaviour.
However I think the default PIP value (0.01) is correct and shouldn't be changed.
I think the culprit is PIPCost
which defaults to 0.01 (like PIP).
Zorro docs say this:
or calculating it manually, multiply LotAmount with PIP;
With LotAmount
= 0.00000001 and PIP
= 0.01, we get PIPCost
= 10^-10 = 0.0000000001
Plugging that in the script with Lots
= 100000000:
function run()
{
asset("BTC/USD");
Lots = 100000000;
MaxLong = 1;
enterLong();
PlotBorder = 100;
set(PLOTNOW,LOGFILE);
}
purchases 1 BTC
I think this would be fixed by modifying the logic here: https://github.com/kzhdev/gdax_zorro_plugin/blob/796e15cf57662ec05a854ca24de80d37565dac6d/gdax_zorro_plugin/gdax_zorro_plugin.cpp#L508
fprintf(f, "%s,%.8f,%.8f,0.0,0.0,%.8f,%.8f,0.0,1,%.8f,0.000,%s\n",
prod.display_name.c_str(), ticker.ask, (ticker.ask - ticker.bid), prod.quote_increment,
prod.quote_increment, prod.base_increment, prod.id.c_str());
becoming
fprintf(f, "%s,%.8f,%.8f,0.0,0.0,%.8f,%.8f,0.0,1,%.8f,0.000,%s\n",
prod.display_name.c_str(), ticker.ask, (ticker.ask - ticker.bid), prod.quote_increment,
prod.quote_increment * prod.base_increment, prod.base_increment, prod.id.c_str());
but this may be wrong when using non-USD symbols ?
if the counter currency is different to the account currency, multiply the result with the counter currency exchange rate. Example 1: AUD/USD on a micro lot EUR account has PipCost of 1000 0.0001 0.9 (current USD price in EUR) = 0.09 EUR. Example 2: AAPL stock on a USD account has PipCost of 1 * 0.01 = 0.01 USD = 1 cent.
I was trying to follow the snippet in the README:
With the mention that by Accounts entry was generated by the plugin:
However, in the simulations I'm getting values that make me think it actually purchases 10k full BTC at once:
This is also reflected in the strategy result too:
Any thoughts how to work with fractional amounts of BTC or other crypto?