Comments (12)
from univocity-trader.
Aha -- That hopefully explains why my simulator results differ a lot than my live results. Does that only require wiring in the, say, Binance API (limitBuy -> limitOCOBuy) and making minor modifications to that switch...case or is it more involved than that? I'm guessing most of the existing code remains intact and the live code should be way more simpler than the simulator code since the logic is server side.
from univocity-trader.
from univocity-trader.
FYI: I'm starting to get this to work (I hope to be able to open a MR eventually) - I can submit an OCO with the values I expect. The response though is trickier because now we get back a list instead of a single value; I'm not super sure if I should hide this behind the same interfaces or fully expose the fact that we're getting a list now (one with limit_maker, one with stop_loss), but I'm leaning towards breaking whatever needs to be broken to handle both cases rather than hack away at it. Objections?
This is what their response looks like for oco:
{
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
"transactionTime": 1563417480525,
"symbol": "LTCBTC",
"orders": [
{
"symbol": "LTCBTC",
"orderId": 2,
"clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos"
},
{
"symbol": "LTCBTC",
"orderId": 3,
"clientOrderId": "xTXKaGYd4bluPVp78IVRvl"
}
],
"orderReports": [
{
"symbol": "LTCBTC",
"orderId": 2,
"orderListId": 0,
"clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos",
"transactTime": 1563417480525,
"price": "0.000000",
"origQty": "0.624363",
"executedQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "STOP_LOSS",
"side": "BUY",
"stopPrice": "0.960664"
},
{
"symbol": "LTCBTC",
"orderId": 3,
"orderListId": 0,
"clientOrderId": "xTXKaGYd4bluPVp78IVRvl",
"transactTime": 1563417480525,
"price": "0.036435",
"origQty": "0.624363",
"executedQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "BUY"
}
]
}
from univocity-trader.
from univocity-trader.
Ok I have something that seems to be working. I'll let it bake for a while before opening a MR (my signals are quite slow so it takes some time to hit all the cases).
BTW During debugging I also found:
I think you meant "return order" there. I can open a separate MR for that if you want, but given it's a one liner you might just want to add that one directly ;-)
from univocity-trader.
from univocity-trader.
I'm tracking my changes in this branch:
https://github.com/wwadge/univocity-trader-1/tree/feature/add-OCO-orders-to-live
Code seems to be working fine, but I lack unit tests at the moment so consider this as a pre-cleanup branch for now.
There's also a small bug I detected: during order processing, it does a try..finalize to update balances, but that balances update code in AccountManager is guarded by a check to avoid fetching balances if not enough tine has passed. So this sometimes leads to: a SELL is triggered, an order is placed, the updateBalance check returns stale data and the next SELL order results in an insufficient funds exception from Binance. I've fixed this in the same branch by adding a "force" flag so skip the cache check.
from univocity-trader.
Thanks a lot! I also think the "force" flag will be required there. Once I get the time I'll check it out.
from univocity-trader.
Hmmm actually I don't think I did this right -- I'm only doing a single OCO order of say BUY if signal returned BUY.
In interactive brokers, we send 3 simultaneous orders: BUY, then an OCO of SELLs. But as far as I can tell, Binance does not support this behaviour, instead it allows you to only do OCO or a market buy or limit; to replicate the behavior of the simulator in Binance I think I have to send a manual market order first to force a buy, then immediately do an OCO with SELLs. Or alternately watch for the "filled" and then trigger the OCO but this will probably need some re-architecting work. Did I think it right?
from univocity-trader.
from univocity-trader.
OK - I'll work on this and open a new MR
from univocity-trader.
Related Issues (20)
- Setup a discord channel for developers HOT 1
- TD Ameritrade interface HOT 1
- Hope to support cross market Pairs trading HOT 4
- Unresolved dependencies when build with maven after cloning project HOT 1
- Build fails if you don't have Interactive Brokers jar HOT 2
- Build fails because of maven-bundle-plugin
- Add support for BInance Spot TestNet
- Add a new indicator
- Broken build HOT 8
- Support for embedded database HOT 8
- Take profit
- Previous candles HOT 2
- VWMA
- Last candles, price signal
- Deprecations of Binance APIs HOT 3
- Interactive Brokers resolution error in maven HOT 6
- Setter for simulation backfill fails to set value
- Bracket orders for Binance
- Running Chart window HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from univocity-trader.