Commit Graph

385 Commits

Author SHA1 Message Date
TonyQ
16862e7208 exchange/stream : implement booktickerupdate event for ftx and
binance
2021-12-22 21:01:11 +08:00
c9s
bace225470 binance: fix, call set time service only when key and secret is given 2021-12-22 01:27:25 +08:00
TonyQ
3e45035ab1 database: sqlite3 issue fix
database: upgrade gosqllite3 version for increasing variable amount limit
	types: update kline starttime/endtime field to prevent sqlite3
	time parsing issue.

	fix #215
2021-12-15 14:34:31 +08:00
Yo-An Lin
05323f211f Merge pull request #368 from tony1223/feature/355-update-sync
backtest : auto sync
2021-12-15 01:39:19 +08:00
austin362667
ccd607ba28 binance: remove unsupported comments 2021-12-15 01:01:05 +08:00
austin362667
7f96fa8dde binance: add multierr 2021-12-15 01:01:05 +08:00
austin362667
bb592663ab binance: removed unsupport isolated futures trade 2021-12-15 01:01:05 +08:00
austin362667
a0130affe4 binance: add query orders & trades 2021-12-15 01:01:05 +08:00
TonyQ
20b03fe4a5 exchange: fix ftx for wrong last kline issue 2021-12-15 00:07:54 +08:00
austin362667
839bb6d0e8 binance: remove comments cuz not support isolated futures 2021-12-14 20:41:55 +08:00
austin362667
d3526b2c71 binance: add SubmitFuturesOrder and related conversions 2021-12-13 23:19:14 +08:00
austin362667
04919e0fa4 binance: add futures exchange stream connection 2021-12-12 15:40:03 +08:00
austin362667
8ca60cec10 binance: add user stream event parser & toGlobalType converter 2021-12-12 15:39:06 +08:00
c9s
ca85aa69e6 pull out global premium index type and funding rate type 2021-12-09 00:10:18 +08:00
c9s
71e043e4b2 move convertPremiumIndex to convert.go 2021-12-09 00:08:25 +08:00
c9s
fbae368e6c make getLaunchDate as a simple function 2021-12-09 00:06:46 +08:00
c9s
078c79d73f binance: refactor QueryMarkets 2021-12-09 00:05:36 +08:00
c9s
48612e2b13 reformat import lines and add fixme note 2021-12-09 00:01:33 +08:00
c9s
35da3ba3a0 check env vars for query related tests 2021-12-05 01:11:47 +08:00
c9s
715363298f fix query ticker tests 2021-12-05 00:58:01 +08:00
c9s
4bde40f2db override binance default http client timeout instead of zero timeout 2021-11-23 10:54:43 +08:00
Austin
c5d1a70a61 add Continuous Contract Kline/Candlestick Streams 2021-11-16 14:26:27 +08:00
Austin
a36739f119 add MarkPriceUpdateEvent 2021-11-16 01:24:36 +08:00
c9s
aceca1b49f adjust listen key keep alive to 30 min 2021-11-07 23:40:13 +08:00
c9s
a2c2646a16 binance: adjust rate limiter bucket 2021-11-05 01:25:16 +08:00
c9s
82d859a43d binance: fix binance order rate limiter 2021-11-05 01:21:58 +08:00
c9s
1a861c98a1 binance: add order rate limiter for binance 2021-11-04 12:50:32 +08:00
c9s
6cb593cd90 techsignal: use realtime funding rate 2021-10-20 14:01:19 +08:00
c9s
16fca0150d implement futures PremiumIndex support 2021-10-19 15:54:16 +08:00
c9s
1e6692ec8d rename funding rate query method name 2021-10-19 15:29:55 +08:00
c9s
e3431ef970 binance: fix binance order type for limit maker 2021-10-18 00:41:41 +08:00
c9s
4523135012 techsignal: add funding rate checker 2021-10-14 23:01:10 +08:00
c9s
7016d24fad import types.FuturesSettings into binance exchange 2021-10-07 21:29:52 +08:00
c9s
b6fff482a4 binance: fix withdrawal time parsing 2021-09-03 14:21:59 +08:00
c9s
35ec9ae7b6 binance: fix binance withdrawal api 2021-09-02 00:27:57 +08:00
c9s
f177860450 binance: fix withdrawal service 2021-09-02 00:21:56 +08:00
c9s
0df26e0570 binance: adjust listen key keep alive to 20 minutes 2021-06-09 01:37:19 +08:00
c9s
457ca79517 binance: for network error, we should retry the request 2021-06-09 01:37:14 +08:00
c9s
ec6c10a96a binance: adjust read timeout and increase read buffer size 2021-06-09 01:36:06 +08:00
c9s
f487b53d9e binance: fix client order id checking 2021-06-07 01:07:00 +08:00
c9s
5fd0ab4cd3 skip client order id when no client order is given 2021-06-07 01:03:21 +08:00
c9s
b9584117d6 add QueryLastFundingRate api to binance exchange 2021-06-01 03:15:19 +08:00
c9s
b5c4fc3e4e fix kline record insert fields 2021-06-01 01:39:23 +08:00
c9s
bf73def701 binance: embed fixedpoint.Value into binance Balance struct 2021-06-01 01:39:22 +08:00
c9s
e3473572e9 types: add TakerBuyBaseAssetVolume and TakerBuyQuoteAssetVolume fields to kline 2021-06-01 01:39:22 +08:00
c9s
2925a77815 binance: use fixedpoint.Value for parsing floating number string 2021-06-01 01:39:22 +08:00
c9s
7ff4051c61 binance: fix websocket handshake 2021-05-30 18:20:14 +08:00
c9s
0b935eff4f fix connection lock call 2021-05-30 18:14:22 +08:00
c9s
d112dbb1a4 binance: check connCancel only when new context is allocated 2021-05-30 15:53:01 +08:00
c9s
f9d4068145 binance: pull out listen key from stream and reduce critical section 2021-05-30 15:51:25 +08:00
c9s
1a05f6fbd4 okex: pull read timeout and adjust to 30 seconds 2021-05-30 00:32:06 +08:00
c9s
d962dbe542 adjust read timeout 2021-05-29 20:40:47 +08:00
c9s
e11553139e binance: make convert functions private 2021-05-29 00:26:39 +08:00
c9s
f49490f986 fix websocket ping/pong issue 2021-05-28 23:34:21 +08:00
c9s
002b28f75a okex: implement candlestick api and improve kline console format 2021-05-28 20:51:10 +08:00
c9s
6407eab9c1 okex: convert order details into trades and orders 2021-05-28 02:21:35 +08:00
c9s
2844b7c3a7 okex: add kline command for testing kline data 2021-05-27 18:35:34 +08:00
c9s
18045bb1e7 Move ReconnectC to the StandardStream 2021-05-27 14:42:14 +08:00
c9s
016c60796d pull out BNB currency string 2021-05-27 00:05:43 +08:00
c9s
ea78c0308b add LocalSymbol field for exchange specific symbol 2021-05-27 00:05:43 +08:00
c9s
8842208441 okex: add market ticker api support 2021-05-27 00:05:43 +08:00
c9s
967c7e9f9d xbalance: add withdrawal options 2021-05-26 23:24:05 +08:00
zenix
698ec9911f Fix error formating on depth load fail 2021-05-26 00:57:35 +00:00
c9s
9c331063f4 improve depth error messages 2021-05-26 01:31:58 +08:00
c9s
06e982124b fix depth reset 2021-05-26 01:27:42 +08:00
c9s
07ded04a9b fix depth reset 2021-05-26 01:20:24 +08:00
c9s
44ff833c91 binance: buffer depth events 2021-05-26 01:05:12 +08:00
c9s
edeaa597f1 fix loadDepthSnapshot mutex lock issue 2021-05-26 00:58:40 +08:00
c9s
47bf7a1e03 remove time sleep for depthframe 2021-05-26 00:58:40 +08:00
c9s
686dcef2c5 binance: fix depth snapshot buffering 2021-05-25 21:36:14 +08:00
c9s
d3f06bc9d7 fix binance depth stream buffering 2021-05-25 19:13:10 +08:00
c9s
56b2c8845b fix preorder, postorder and inorder 2021-05-22 11:36:58 +08:00
c9s
57a78777df move Time type to types.Time 2021-05-21 00:10:53 +08:00
c9s
e95429bbc3 binance: save newer events for later usage 2021-05-19 01:02:41 +08:00
c9s
2fddc9166f show bid/ask volume in the message 2021-05-19 00:41:34 +08:00
c9s
e636a5008d replace Exchange field type with ExchangeName 2021-05-16 17:02:23 +08:00
c9s
5c10f8a4e2 binance: call set server time service 2021-05-16 15:03:31 +08:00
Lee
d1cef15f75 Fix: Correct the Order FILLED event on binance 2021-05-13 00:41:23 +08:00
Lee
b0e71e4258 Fix: Correct the binance executionReport parser
Let JSON parse to be explicit for prevent Unmarshal case-insensitive issue
2021-05-12 18:45:16 +08:00
c9s
fd6fe56f32 implement withdrawal request on binance 2021-05-12 02:15:22 +08:00
c9s
d85037f9ea add binance kline query documentation 2021-05-05 16:23:46 +08:00
c9s
8fea2022e5 adjust rate limit for backtest data syncing 2021-05-02 17:46:08 +08:00
c9s
5d2296eddd extract client order id generation 2021-04-28 19:20:55 +08:00
zenix
2bda296194 Fix: upgrade binance api, fix go fmt, add hard start time for binance to reduce sync execution time 2021-04-21 19:50:33 +09:00
Wei-Ning Huang
e7961be86a binance: set TimeInForce to GTC by default for limit orders
Binance does not allow submitting order without TimeInForce set for
certain order types. Set TimeInforce to GTC (Good-Til-Cancel) by
default.
2021-04-14 09:49:03 +08:00
c9s
8122fddd02 add exchange field to binance trades and binance orders 2021-03-24 17:51:19 +08:00
c9s
a52101b163 remove bps from the fee calc 2021-03-20 22:53:14 +08:00
ycdesu
c8447663db refactor: use fixedpoint to store fee 2021-03-19 08:49:24 +08:00
ycdesu
83ae943a4f ftx: calculate commission 2021-03-18 23:58:28 +08:00
c9s
2f7c7d344b move emitStart method call into the stream Connect method 2021-03-16 01:32:27 +08:00
c9s
c95e712420 binance: emit disconnect 2021-03-15 17:48:16 +08:00
c9s
61a19cbfb4 align fields and tags 2021-03-15 17:31:07 +08:00
c9s
ab6b56d91e fix taker volume parsing 2021-03-15 15:37:53 +08:00
c9s
4d3b1ec938 fix QueryWithdrawHistory and QueryDepositHistory 2021-03-14 11:18:22 +08:00
c9s
3f0290479b binance: update withdraw and deposit types 2021-03-14 11:18:22 +08:00
c9s
3e616c5fac convert and parse binance margin account structure 2021-02-28 15:06:20 +08:00
c9s
32c2780b16 convert binance margin account data into the global structure 2021-02-28 15:06:20 +08:00
c9s
65ff2894c5 binance: calculate quote quantity manually if it's not defined 2021-02-18 18:24:00 +08:00
c9s
3a89b0a714 improve trade sync 2021-02-18 18:20:18 +08:00
c9s
0ba595bd55 Fix trade sync for self trades
MAX uses one single trade for presenting self trade.

BINANCE uses two trade records for presenting self trade. the trade
creation time are the same.
2021-02-18 17:37:49 +08:00
c9s
c3dbb1b204 avoid using last trade id for syncing data 2021-02-18 16:40:47 +08:00
c9s
29bbd03836 add binance single ticker query method and fix quantity formating 2021-02-18 16:17:40 +08:00
c9s
f7ef91b55c binance: set the default ping handler 2021-02-11 08:13:50 +08:00
c9s
ffa001fc29 fix quantity format 2021-02-11 00:21:56 +08:00
ycchen
7a67083fbe Address review feedbacks 2021-02-07 22:58:30 +01:00
ycchen
288f7257eb fix testcases 2021-02-06 19:39:43 +01:00
ycchen
5fed7b81de QueryTicker 2021-02-06 18:35:23 +01:00
ycchen
fa20df487e feat: ticker api for types.Exchange 2021-02-06 14:05:26 +01:00
c9s
26f9e5488d apply datatype.Time to order time fields 2021-02-06 14:30:00 +08:00
c9s
3abdb3dd7b convert time struct for sqlite driver 2021-02-06 12:32:21 +08:00
c9s
6912f77c72 fix lock issue 2021-02-01 18:55:47 +08:00
c9s
b952e6fd54 rename Reset to private reset 2021-01-25 14:26:22 +08:00
c9s
4c0a586aa2 adjust depth update to 5 minutes 2021-01-25 14:24:59 +08:00
c9s
b99c01a03f fix stream book usage 2021-01-25 14:13:39 +08:00
c9s
1aefbbfddc improve orderbook validation error 2021-01-25 13:53:11 +08:00
c9s
e2de3040bd adjust ping ticker to 10seconds 2021-01-24 19:08:33 +08:00
c9s
7632638982 log depth api error 2021-01-24 16:54:13 +08:00
c9s
cabc082713 fix f.loadDepthSnapshot timing 2021-01-24 14:12:44 +08:00
c9s
50fc1fd3ac call Reset instead of replacing the whole map
the reason is that we have the update worker, which is already started.
2021-01-24 14:09:07 +08:00
c9s
2b441ad3bc binance: improve depth event filtering and reloading 2021-01-24 10:02:38 +08:00
c9s
e08d62395e adjust snapshot ticker to 10 minutes 2021-01-23 17:03:53 +08:00
c9s
6a6dacd595 fix binance depth snapshot updating 2021-01-23 16:59:51 +08:00
c9s
0e99d9bdcb move time.Sleep to batch processor to avoid rate limit 2021-01-20 02:32:55 +08:00
c9s
c79c7d1b11 fix margin order/trade sync 2021-01-20 02:09:12 +08:00
c9s
7520430b52 support margin api for query trades 2021-01-20 01:27:27 +08:00
c9s
1d8b7dc657 handle trade and order margin field 2021-01-20 01:24:29 +08:00
c9s
2c1c9a046b tmp 2021-01-19 23:31:04 +08:00
c9s
677f4b93e6 add margin mode support to QueryOpenOrders 2021-01-19 23:31:04 +08:00
c9s
ad4226f35b support margin order creation 2021-01-19 23:31:04 +08:00
c9s
3eda64641e use exchange's margin option 2021-01-19 23:31:04 +08:00
c9s
7235100140 integrate submitMarginOrder api 2021-01-19 23:31:04 +08:00
c9s
5cab37488b move MarginSettings struct to a file 2021-01-19 23:31:04 +08:00
c9s
f505c0e2c6 split go routine for keep alive and ping tickers 2021-01-19 23:31:04 +08:00
c9s
48083151aa turning margin mode 2021-01-19 23:31:04 +08:00
c9s
c3db6db590 add margin option 2021-01-19 23:31:04 +08:00
c9s
50cd6f7d68 change go-binance to github.com/adshao/go-binance/v2 2021-01-11 13:36:49 +08:00
c9s
70479bfd16 binance: assign Isolated field 2020-12-29 17:26:22 +08:00
c9s
f56318c9b6 add public only mode to stream 2020-12-21 15:43:54 +08:00
c9s
ce0e28708a add public only mode to binance stream 2020-12-21 15:26:05 +08:00
c9s
d4b99f41a4 reformat 2020-12-21 14:55:14 +08:00
c9s
39f5290634 shorten the log messages 2020-12-21 14:53:34 +08:00
c9s
a60529ee37 reload depth snapshot periodically 2020-12-21 14:43:40 +08:00
c9s
4f399ebb9f fix stop price formating 2020-12-03 09:25:47 +08:00
c9s
edb22383c7 fix ToGlobalOrder call 2020-12-02 22:44:57 +08:00
c9s
4cf5929cac improve trade parsing error 2020-12-02 22:21:13 +08:00
c9s
95b0910a09 fix trade order id parsing 2020-11-17 14:13:37 +08:00
c9s
03d99a4cab remove debug logs 2020-11-17 13:25:59 +08:00
c9s
f4512f031c improve cross exchange strategy mounting behavior and add fixedpoint atomic ops 2020-11-17 08:19:22 +08:00
c9s
3ea2e877ff do not submit subscribe request if param array is empty 2020-11-15 13:32:46 +08:00
c9s
23c19c5968 use fixedpoint for balances 2020-11-10 14:19:33 +08:00
c9s
1e925cac6e move onConnect to the standard stream 2020-11-07 12:38:57 +08:00
c9s
b13a2deec5 emit klines and setup account balances 2020-11-07 03:18:05 +08:00
c9s
8823a39fc2 support backtesting kline verification 2020-11-07 00:49:17 +08:00
c9s
555fe57341 implement kline sync function from command 2020-11-06 21:40:48 +08:00
c9s
78d7c71ecc add kline service and extend kline struct fields 2020-11-06 19:07:07 +08:00
c9s
7e47f754c5 use channel to sync trades 2020-11-05 13:35:04 +08:00
c9s
7fab2e24de improve order persistence and support order data sync 2020-11-05 11:14:14 +08:00
c9s
a4555a2b7b implement QueryClosedOrders 2020-11-05 11:14:14 +08:00
c9s
fe16f9aa4d add is_working column 2020-11-05 11:14:14 +08:00
c9s
bb0ff263c8 assign order_id to the trade object 2020-11-05 11:14:14 +08:00
c9s
14abe3fb7e pull out active order book to the types package 2020-10-31 20:38:20 +08:00
c9s
9c46ef17b2 handle order update 2020-10-31 18:29:58 +08:00
c9s
60b78979dc fix order id parsing (seems case insensitive) 2020-10-31 18:29:58 +08:00
c9s
c3961024cf implement grid strategy update orders method 2020-10-31 18:29:58 +08:00
c9s
e2df24f31c support standard indicatorset 2020-10-28 09:43:19 +08:00
c9s
085d02bee4 clean up strategy code since we can loaded from the config 2020-10-26 22:04:48 +08:00
c9s
145264aae4 cancel orders and re-submit maker orders 2020-10-26 00:26:17 +08:00
c9s
de11ef10f5 return created order objects from SubmitOrders method 2020-10-25 19:22:22 +08:00
c9s
fa30f6b52a Support binance order update execution type convertion 2020-10-25 19:22:22 +08:00
c9s
391767953a Fix binance trade transaction time convertion 2020-10-25 19:22:22 +08:00
c9s
308427416a Add more exchange order features
- use uuid for client order id
- add stop limit and stop market order types
- add order convert functions
- improve submit orders
2020-10-25 19:22:22 +08:00
c9s
678e4ef4ab add trade reporter 2020-10-22 10:47:54 +08:00
c9s
822e4c2703 receive trade in value instead of pointer 2020-10-19 22:06:43 +08:00
c9s
73e17730d7 move account type into types package 2020-10-18 11:30:37 +08:00
c9s
2d88f8e5f6 remove unused empty method convertDepthResponseToSnapshot 2020-10-17 23:49:14 +08:00
c9s
ee86a71ebb split files 2020-10-16 10:14:36 +08:00
c9s
c58375f57e max: extend max exchange market information 2020-10-14 10:53:18 +08:00
c9s
88461396f1 rearrange market config fields 2020-10-14 10:39:14 +08:00
c9s
2b41f76082 add maxPrice, minPrice and tickSize config 2020-10-14 10:34:33 +08:00
c9s
64c2170cd5 implement QueryMarkets on binance 2020-10-14 10:16:59 +08:00
c9s
a91f851ac7 pass types.SubmitOrder by value 2020-10-13 18:08:02 +08:00
c9s
4ce716d6ad binance: make asset parameter optional 2020-10-12 17:15:33 +08:00
c9s
ea7b501c26 add transfer history command for calculating baseline and show transfer records 2020-10-11 20:08:54 +08:00
c9s
2d246c3f71 move deposit type to global type and add max deposit history support 2020-10-11 17:35:59 +08:00
c9s
3d5507a053 move files into pkg 2020-10-11 16:46:15 +08:00