Commit Graph

1097 Commits

Author SHA1 Message Date
c9s
c0f12cf452 xmaker: add active maker order cancellation check 2021-05-09 18:32:29 +08:00
なるみ
52248fcf2e feature: add MACD indicator (#219) 2021-05-09 00:56:44 +08:00
Frank Chang
da0ea3d390 fix(bollgrid): skip canceling profit order on graceful exit
profit orders shouldn't be canceled on graceful exit unless
properly persisted.

a new strategy parameter `shutdownCancelProfitOrders` is added.

Issue: #220
2021-05-08 15:19:04 +08:00
なるみ
3f39131d76 feature: add volume weighted average price (vwap) indicator (#211) 2021-05-08 02:09:45 +08:00
c9s
fd7081e96f bump version to v1.15.5 2021-05-08 01:11:31 +08:00
c9s
d01abffde3 add todo for the backtest trades 2021-05-08 01:09:06 +08:00
c9s
13d9f2ba49 grid: fix order generator checking 2021-05-08 01:00:57 +08:00
c9s
a94c42d9c2 grid: improve error messages 2021-05-08 00:59:30 +08:00
c9s
ee68deb114 apply limit param to the queries 2021-05-08 00:57:25 +08:00
c9s
d8d2e17b9e fix backtest exchange query klines methods 2021-05-08 00:57:12 +08:00
c9s
6bbd66a4f9 split environment start and init 2021-05-08 00:45:24 +08:00
c9s
14eedecd0e fix backtest sync from time 2021-05-08 00:44:43 +08:00
c9s
61ad2b6567 emit start callback for backtest 2021-05-08 00:43:53 +08:00
c9s
3501e8f5fd refactor backtest, add BootstrapBacktestEnvironment 2021-05-08 00:14:25 +08:00
c9s
f67075c818 bump version to v1.15.4 2021-05-07 14:08:11 +08:00
c9s
858d6bdf05 grid: adjust callback registration ordering 2021-05-07 02:14:35 +08:00
c9s
494a270c54 insert trades to db only when backtest service is nil 2021-05-07 01:50:38 +08:00
c9s
584a4c2ef8 move fiat currency definition out 2021-05-07 01:30:09 +08:00
c9s
1264c50e83 improve balances, account command usability 2021-05-06 23:50:26 +08:00
c9s
1a81813e17 add --session option check 2021-05-06 23:44:05 +08:00
c9s
03cee5eb0b apply types.ExchangeMAX 2021-05-05 16:57:01 +08:00
c9s
859bf35255 set sync-from from config by default 2021-05-05 16:45:17 +08:00
c9s
a70d5cbcdc fix kline sync conditions 2021-05-05 16:33:15 +08:00
c9s
d85037f9ea add binance kline query documentation 2021-05-05 16:23:46 +08:00
c9s
1ad8b0b641 remove unused SourceDir func 2021-05-04 01:06:20 +08:00
c9s
0fbc388333 add --webserver-bind option and add option to --enable-webserver 2021-05-03 17:24:39 +08:00
Larry850806
f1309c46fc bollgrid: check balance before submit reverse order 2021-05-03 16:18:58 +08:00
c9s
50db944053 fix initSymbol stages 2021-05-02 23:58:34 +08:00
c9s
2230c56e56 fix comment warning 2021-05-02 23:48:53 +08:00
c9s
2ef13293e9 fix IDE warnings 2021-05-02 23:47:57 +08:00
c9s
5ec0566888 add more injection checks 2021-05-02 23:46:16 +08:00
c9s
822a010932 add moving average configuration to the schedule strategy 2021-05-02 20:58:32 +08:00
c9s
e29d9af9c8 fix persistence config unmarshalling 2021-05-02 18:16:34 +08:00
c9s
20d673f769 add schedule strategy 2021-05-02 18:03:41 +08:00
c9s
8fea2022e5 adjust rate limit for backtest data syncing 2021-05-02 17:46:08 +08:00
c9s
471e0a4c45 pass string format quantity and price 2021-04-28 19:48:17 +08:00
c9s
9f77236999 fix and improve position accessor 2021-04-28 19:32:49 +08:00
c9s
e87c2e271f add broker id on max 2021-04-28 19:24:07 +08:00
c9s
5d2296eddd extract client order id generation 2021-04-28 19:20:55 +08:00
c9s
36beabaa0b bump version to v1.15.3 2021-04-28 18:00:23 +08:00
c9s
70a53ed286 make config compatible with key 'strategies' 2021-04-28 17:58:50 +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
zenix
2d6eb02e6c compile and update migration package 2021-04-21 11:21:15 +09:00
Larry850806
453a906a5a bollgrid: use onStart instead of onConnect 2021-04-15 15:51:23 +08:00
Larry850806
980f1ae3e7 bollgrid: submit buy/sell orders separately 2021-04-15 12:31:18 +08:00
Larry850806
aa950b3dc4 bollgrid: track createdOrders when error occurs 2021-04-15 12:31:18 +08:00
Larry850806
a80afff0c2 grid: track createdOrders when error occurs 2021-04-15 12:31:18 +08: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
David Chang
f884fcd45c fix: add ioc trade type to order type 2021-04-12 14:35:46 +08:00
David Chang
0db2cc2c96 fix: add ioc trade type to order type 2021-04-12 09:35:59 +08:00
David Chang
c9198d498e feature: add ioc order type support to max exchange 2021-04-11 12:29:23 +08:00
c9s
2ec4617694 add SyncService check 2021-04-09 12:44:30 +08:00
c9s
34fe915a9f fix sync issue for pnl command 2021-04-09 12:43:13 +08:00
c9s
d315c12f2d call environ.Init to setup sessions 2021-04-09 00:46:36 +08:00
Yo-An Lin
435f7fb12e Merge pull request #190 from jnlin/feat/telegram-group
feat: allow telegram bot send to group
2021-04-04 11:21:20 +08:00
c9s
13a8597d59 add MaxExposurePosition settings 2021-04-04 11:14:09 +08:00
Jui-Nan Lin
1b953d88d4 feat: allow bot send to group 2021-04-03 12:50:13 +08:00
Larry850806
6718aace8c Add validation for support strategy 2021-04-02 10:32:38 +08:00
Larry850806
53133851cc Add validation for grid strategy 2021-04-02 10:32:38 +08:00
Larry850806
2c41ec28ae Add validation for bollgrid strategy 2021-04-02 10:32:34 +08:00
Larry850806
dbf5d27f30 Add a validator interface to validate strategy before run 2021-04-02 10:12:55 +08:00
ycdesu
1e3ce81c06 ftx: pull out map 2021-04-01 11:55:27 +08:00
ycdesu
a659bacb0d ftx: remove back slash from symbol 2021-04-01 11:54:16 +08:00
ycdesu
28c9ac95ac ftx: query kline using rest api 2021-03-31 18:09:13 +08:00
ycdesu
f912fde6e3 ftx: panic if subscribe unsupported channel 2021-03-29 22:11:39 +08:00
ycdesu
66f165584f fix: make since/until optional 2021-03-29 22:11:39 +08:00
ycdesu
f526a937d1 ftx: websocket keepalive 2021-03-29 22:11:39 +08:00
ycdesu
53c9b0a606 ftx: remove redundant abstraction 2021-03-29 22:11:39 +08:00
ycdesu
e152aa1036 ftx: trade update 2021-03-29 22:11:39 +08:00
ycdesu
f345730778 ftx: handle err response 2021-03-29 22:11:38 +08:00
ycdesu
9c4ccbd6e2 ftx: subscribe order update 2021-03-29 22:11:38 +08:00
ycdesu
34ea325499 ftx: refactor websocket_messages structs 2021-03-29 22:11:38 +08:00
ycdesu
d3cdd3c2a6 ftx: define order update response 2021-03-29 22:11:38 +08:00
ycdesu
2e2ae46bae ftx: subscribe order update 2021-03-29 22:11:38 +08:00
ycdesu
f60f1ef52e ftx: authenticate websocket 2021-03-27 18:16:52 +08:00
ycdesu
24254a869d ftx: invoke SetPublicOnly in orderbook command 2021-03-27 17:37:16 +08:00
ycdesu
34548f185c ftx: add missing ftx case 2021-03-27 17:00:55 +08:00
ycdesu
691251169d ftx: define ws login request 2021-03-27 16:58:51 +08:00
ycdesu
3bcd5a8e83 ftx: null guard in close 2021-03-27 09:54:12 +08:00
ycdesu
9e77b3afd8 ftx: support queryTrades method 2021-03-26 00:43:15 +08:00
c9s
c82df27cf3 grid: fix message format 2021-03-25 15:22:52 +08:00
c9s
13af4505f7 bump version to v1.15.2 2021-03-25 13:41:44 +08:00
c9s
129b25d86e fix persistence key 2021-03-25 13:18:38 +08:00
c9s
89c01adf60 xmaker: fix state passing for persistence 2021-03-25 13:16:48 +08:00
c9s
121a679d4a fix margin struct tag 2021-03-25 13:16:27 +08:00
c9s
8122fddd02 add exchange field to binance trades and binance orders 2021-03-24 17:51:19 +08:00
YC
80e5144950 Merge pull request #184 from c9s/ftx/add-missing-query-string 2021-03-24 16:26:33 +08:00
ycdesu
241f1ee9de ftx: support lastOrderID 2021-03-23 22:27:11 +08:00
ycdesu
17b6122cf8 ftx: assign query string to order/wallet requests 2021-03-23 22:26:18 +08:00
ycdesu
bce749c13b ftx: add missing query string 2021-03-23 22:25:57 +08:00
ycdesu
33046df35b ftx: list closed orders 2021-03-23 22:25:21 +08:00
ycdesu
cb52b436cb ftx: add log 2021-03-23 22:25:05 +08:00
c9s
cbd43c159f bump version 2021-03-23 21:52:42 +08:00
c9s
29f77c2176 add environ.DatabaseService nil check for backtest 2021-03-22 22:48:43 +08:00
c9s
3a842836cd bump version 2021-03-22 18:51:32 +08:00
c9s
5de221524f adjust state and reset per day 2021-03-22 18:48:18 +08:00
c9s
6c8babfb27 allow public session 2021-03-22 17:40:17 +08:00
c9s
67bfc508c8 max: remove unnecessary log 2021-03-22 17:40:00 +08:00
c9s
2b27815929 move out groupID to the maxapi package 2021-03-22 17:32:22 +08:00
c9s
706b38efa3 gap: finalize the implementation 2021-03-22 17:32:22 +08:00
c9s
111b3ba036 max: improve multi-order request 2021-03-22 17:32:22 +08:00
c9s
3c5071b87e use uint32 for groupID 2021-03-22 17:32:22 +08:00
c9s
cd5ac1ddf5 fix convert for limit maker 2021-03-22 17:32:22 +08:00
c9s
865dda14f5 gap: accumulate fee 2021-03-22 17:32:22 +08:00
c9s
24c4d05e91 max: load websocket base url from the env var 2021-03-22 17:32:21 +08:00
c9s
088b22f338 support bbgo-no-cache option 2021-03-22 17:32:21 +08:00
c9s
e86f29b7cc add gap strategy 2021-03-22 17:32:21 +08:00
ycdesu
ab743f85c2 ftx:support deposit histories 2021-03-21 20:17:41 +08:00
ycdesu
d2a5a755be ftx: implement queryMarket 2021-03-21 13:06:46 +08:00
ycdesu
14652c6918 ftx: define market request 2021-03-21 13:06:46 +08:00
ycdesu
c30a026243 ftx: support market cmd 2021-03-21 13:06:46 +08:00
Yo-An Lin
1293dbb64b Merge pull request #180 from c9s/strategy/xmaker
feature: add strategy xmaker
2021-03-21 13:00:00 +08:00
c9s
814a77ea39 xmaker: improve balance checking 2021-03-21 12:55:33 +08:00
c9s
2a067e5cb4 add more balance check for hedging 2021-03-21 12:55:33 +08:00
c9s
1f744b0fa5 convert limit maker type to post only 2021-03-21 12:55:33 +08:00
c9s
837934e690 add post_only order type 2021-03-21 12:55:33 +08:00
c9s
6b877e1394 add limit maker order type 2021-03-21 12:55:33 +08:00
c9s
4e3f325bb6 first commit of xmaker strategy from mobydick 2021-03-21 12:55:33 +08:00
ycdesu
04870acbab fixedpoint: get num of fractional parts 2021-03-21 12:52:45 +08:00
c9s
cf1262c1a9 update version.go 2021-03-21 10:20:00 +08:00
c9s
ca27bf100d grid: use instance id for persistence 2021-03-20 23:07:04 +08:00
c9s
ef8543db8a show accumulative arbitrage profit in the message 2021-03-20 23:05:11 +08:00
c9s
b4083bdf10 fix fee calc tests 2021-03-20 22:59:53 +08:00
c9s
a52101b163 remove bps from the fee calc 2021-03-20 22:53:14 +08:00
c9s
d97275e408 query max account fee from the vip level api 2021-03-19 17:06:48 +08:00
YC
062a008674 Merge pull request #174 from c9s/ftx/fix-placeorder-init 2021-03-19 10:35:54 +08:00
ycdesu
a7bdcdff38 fix: fix placeorder cmd 2021-03-19 10:07:39 +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
ycdesu
a62481590e ftx: support PlatformCurrency 2021-03-18 23:58:28 +08:00
ycdesu
8a75b21a38 ftx: support account info 2021-03-18 23:53:55 +08:00
Yo-An Lin
9e596a0f63 Merge pull request #171 from c9s/feature/grid-profit-notification
strategy: calculate grid arbitrage profit per order
2021-03-18 18:19:09 +08:00
c9s
dffd9fc980 add VipLevel api query support 2021-03-18 17:58:18 +08:00
c9s
890324a4ad maxapi: add VipLevel 2021-03-18 17:58:18 +08:00
c9s
761d51597d add todo fee rate here 2021-03-18 17:48:05 +08:00
c9s
4975fb5498 track arbitrage orders 2021-03-18 17:20:21 +08:00
c9s
a95c3b94a0 core: set default store ID 2021-03-18 17:20:07 +08:00
c9s
0e6918a352 grid: add profit field 2021-03-18 15:46:14 +08:00
Yo-An Lin
40b376802e Merge pull request #168 from c9s/feature/mark-trade-strategy 2021-03-18 10:31:59 +08:00
Yo-An Lin
06381c250b Merge pull request #165 from Larry850806/remove-useless-code-in-balances-cmd 2021-03-18 10:31:41 +08:00
Larry850806
28f4584191 Use empty config if config file doesn't exist 2021-03-18 10:04:41 +08:00
c9s
cad8349a1a remove state OrderStateFinalizing from the order state
since we are only interested in the closed orders
2021-03-18 01:15:49 +08:00
c9s
dd87bde785 fix reward sync time range issue 2021-03-18 01:15:38 +08:00
c9s
85b6cb81a2 make local active orderbook json marshallable 2021-03-18 01:15:06 +08:00
c9s
8d784576cd put state vars into the state struct for persistence 2021-03-18 01:14:56 +08:00
c9s
72c1f55b70 fix grid price calculation 2021-03-18 00:46:25 +08:00
c9s
4a415a43b3 fix reward query 2021-03-18 00:46:10 +08:00
c9s
90477826cf implement byte parser for fixedpoint parsing 2021-03-17 22:20:25 +08:00
ycdesu
4a5a53ea28 ftx: support queryClosedOrders 2021-03-17 21:26:25 +08:00
Larry850806
4dc478590f Remove configuring database in balances cmd 2021-03-17 14:35:00 +08:00
ycdesu
54ca62ac5c ftx: define ordersHistory in rest client 2021-03-17 08:18:37 +08:00
ycdesu
342b0dd1dd ftx: cancel orders 2021-03-16 22:36:44 +08:00
Yo-An Lin
7ecb17dbe2 Merge pull request #163 from c9s/feature/mark-trade-strategy 2021-03-16 22:34:09 +08:00
c9s
216c12b49e backup and restore position 2021-03-16 20:07:54 +08:00
c9s
a1667010eb fix filled grid map assignment 2021-03-16 20:05:03 +08:00
c9s
714d61a829 add grid restore behavior 2021-03-16 20:04:06 +08:00
c9s
8c08cfebb7 rename MarkStrategyID to just Mark 2021-03-16 14:07:47 +08:00
Yo-An Lin
f5b65e795e Merge pull request #160 from c9s/feature/grid-options 2021-03-16 12:59:14 +08:00
c9s
ebcef65b01 mark trades with the strategy ID 2021-03-16 10:58:51 +08:00
c9s
478bef526d copy the position object and send notification 2021-03-16 02:22:00 +08:00
c9s
98995bc75c use debug log for skipping filled grid 2021-03-16 02:21:46 +08:00
c9s
f56df038aa fix position and add catchup mode for grid strategy 2021-03-16 02:18:17 +08:00
c9s
60aa7df69a adjust withdraw/deposit query limit since there are no many in most cases 2021-03-16 02:14:24 +08:00
c9s
40fded70b2 reformat scale.go 2021-03-16 02:14:10 +08:00
c9s
c5eb6483a5 integrate QueryTicker for backtesting 2021-03-16 02:13:52 +08:00
c9s
2f7c7d344b move emitStart method call into the stream Connect method 2021-03-16 01:32:27 +08:00
c9s
7951c38edc skip connection if there is no subscription 2021-03-16 01:31:56 +08:00
ycdesu
c08899f7fb ftx: add ftx to supported exchange 2021-03-15 20:40:04 +08:00
ycdesu
c88297117b ftx: new rest everytime 2021-03-15 19:02:14 +08:00
c9s
c3996aee2b add Backup method to the local active order book 2021-03-15 18:25:36 +08:00
c9s
46c59f5009 add both side and support json unmarshalling 2021-03-15 18:09:55 +08:00
c9s
2bf4a555ec use OnStart instead of OnConnect
this is for avoiding re-connect issue
2021-03-15 18:04:55 +08:00
c9s
e311a182fa add onStart callbacks 2021-03-15 18:04:03 +08:00
c9s
9f7af3ce82 assign SubAccount name to the new exchange session 2021-03-15 17:51:17 +08:00
c9s
c95e712420 binance: emit disconnect 2021-03-15 17:48:16 +08:00
c9s
6d249cf83c bypass disconnect event 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
7b7811bbc3 revise orderbook command options 2021-03-15 10:23:53 +08:00
c9s
b24c69729a improve orderbook print layout 2021-03-15 10:23:42 +08:00
c9s
3ffa319ba8 improve max websocket reconnecting issue 2021-03-15 10:23:20 +08:00
c9s
e8ccc5eabf pass SubAccount field to the factory 2021-03-15 10:23:00 +08:00
c9s
97d427a9ca add ftx into the standard exchange factory 2021-03-15 10:22:45 +08:00
c9s
2eda012f43 add SubAccount field to the exchange session config 2021-03-15 10:13:41 +08:00
c9s
b7da47411e split exchange interface into ExchangeMarketDataService, ExchangeTradingService 2021-03-15 10:06:02 +08:00
c9s
c788601856 add disconnect callbacks on stream 2021-03-15 09:49:22 +08:00
Yo-An Lin
e0d7fefbf2 Merge pull request #150 from c9s/fix/pnl
feature: add deposit service and withdraw service for sync
2021-03-15 09:01:24 +08:00
Yo-An Lin
806a32724f Merge pull request #153 from c9s/improve/balances-cmd 2021-03-14 11:51:49 +08:00
c9s
afb8105694 add reward service todo 2021-03-14 11:18:23 +08:00
c9s
38b9baf340 connect sync with deposit and withdraw services 2021-03-14 11:18:23 +08:00
c9s
54ba240317 implement deposit sync 2021-03-14 11:18:22 +08:00
c9s
0246e298d2 apply launch date if since time is empty 2021-03-14 11:18:22 +08:00
c9s
75c6a2791c reduce log 2021-03-14 11:18:22 +08:00
c9s
ccbb78ce4d migration: extend tx id and address size 2021-03-14 11:18:22 +08:00
c9s
8e85274876 fix used time field for withdraw 2021-03-14 11:18:22 +08:00
c9s
b25671c864 fix max deposits history ordering 2021-03-14 11:18:22 +08:00
c9s
75778675e3 fix withdraw query order 2021-03-14 11:18:22 +08:00
c9s
dbcf35e4a4 add FeeCurrency field 2021-03-14 11:18:22 +08:00
c9s
2d6b6e7427 fix withdrawal data ordering 2021-03-14 11:18:22 +08:00
c9s
4d3b1ec938 fix QueryWithdrawHistory and QueryDepositHistory 2021-03-14 11:18:22 +08:00