Closed dadrake3 closed 6 years ago
Hi, This is a duplicate of #297
Could you explain why the positions are stored as currency pairs and not as individual currencies. Having a position of 1 usd_btc doesnt make much sense when in reality that means I have 1 btc. Also, when performing live trading do all my quote currencies have to be the same or can I trade arbitrary pairs? The reason I am asking this is because in order to perform arbitrage on more than one currency pair I would have to write an algorithm for each desired pair which doesn't make much sense eitgher.
@dadrake3 Another related issue is #322. This is all due to the fact that Catalyst was forked from Zipline, which was developed to trade stocks and futures, not currency pairs. I doubt there is a simple fix for that, as it would require rethinking the whole structure of the engine.
@sam31415 do you know if you can have multiple quote currencies when live trading, like could I trade btc_eth and xrp_usd in one algorithm? This seems like its only an issue of tracking the portfolio balances for back testing / order simulation..
@dadrake3 As far as I know it's not possible. I once tried to have a strategy trade on Binance with USDT as a base currency, but trying to take advantage of the many xxx_btc pairs by trading simultaneously xxx_btc and btc_usdt. It turned out to be impossible.
@sam31415 so if I wanted to trade multiple quote currencies I will need to have multiple algorithms running? Do you know of any better way to do multiple pair arbitrage?
@dadrake3 I don't think this would even be a solution, because the different algorithms would not be able to share the balances. If Algo 1 sells the btc Algo 2 bought, Algo 2 will complain that its balance went down, adjust it and count it as a pure loss.
I didn't think much about arbitrage strategies so far.
@sam31415 Can I just pull the current balance off each exchange such that catalyst wont complain?
@dadrake3 Yes you can. But Catalyst records its own balance for each pair, and this balance is impossible to modify as far as I know (#312). My guess is that you'll have trouble ordering if it's off.
@sam31415 So just to clarify, If i am currently holding USD, BTC, and ETH on binance (in real life), I could not use catalyst to buys BTC with USD, then buy ETH with BTC, and lastly to buy USD with ETH? Or will the orders properly execute but the local portfolio will be out of wack
Certainly not with a single algo. And yes, the local portfolio would be out of wack.
Dear Catalyst Maintainers,
Before I tell you about my issue, let me describe my environment:
Environment
$ uname --all
)Now that you know a little about me, let me tell you about the issue I am having:
Description of Issue
When executing a trade in backtest mode I am trying to first simulate purchasing one btc with usd, then on the next call to handle data I want to use some of that btc to purchase 1 eth on the same exchange. My quote currency is usd which I think may be the problem because cash gets decreased by the price of the eth in btc, which doesn't make sense...
Inside the context variable what I expect to happen is the first order will decrease cash by ~10,000$, then the second order wont decrease cash but instead will decrease the open position of the 1 btc just purchased by ~0.07.
The initial values should be 10,000 usd, 0 btc, 0eth, then after one iteration 0 usd, 1 btc, 0 eth then finally 0 usd, 0.93 btc, 1 eth
Here is how you can reproduce this issue on your machine:
Reproduction Steps
if context.toTrade == 0: order(asset=context.btc_usd, amount=1)
What steps have you taken to resolve this already?
stepped through the debugger and inspected the context variables for the open position list and cash values
Sincerely, D