Commit Graph

3147 Commits

Author SHA1 Message Date
c9s
e7dfd4a654
fix reflect insert (remove gid field) 2022-06-08 12:08:04 +08:00
zenix
7a045a48d4 fix: drift window in factorzoo, order_execution print order, refactor: use defer to mu.Unlock in depth/buffer.go 2022-06-08 12:14:53 +09:00
zenix
8361689974 fix: check for div zero in drift indicator 2022-06-08 11:07:26 +09:00
zenix
9dd8dbbede feature: add drift indicator, split heikinashi's Queue 2022-06-08 01:21:18 +08:00
c9s
792e67e982
bump version to v1.33.0 2022-06-07 22:34:16 +08:00
c9s
e92e0f04f3
bump version to v1.33.0 2022-06-07 22:31:08 +08:00
c9s
ea2ba5d11e
bump version to v1.33.0 2022-06-07 22:24:47 +08:00
c9s
7f07852086
fix filled market order update event duplicated trigger 2022-06-07 20:27:11 +08:00
c9s
fc8d3ea59f
register dca strategy to builtin 2022-06-07 20:26:56 +08:00
c9s
9a29843477
add dca strategy 2022-06-07 20:26:44 +08:00
c9s
dc0cb30b23
fix order submit message format 2022-06-07 20:26:33 +08:00
c9s
7e92e6592a
backtest: add test case for testing order update callbacks 2022-06-07 19:36:55 +08:00
Andy Cheng
9836fbbf82 strategy: rebase 2022-06-07 16:49:43 +08:00
Andy Cheng
39615c8981 indicator: get supertrend signal 2022-06-07 16:44:15 +08:00
Andy Cheng
14e70007d9 indicator: supertrend 2022-06-07 16:44:15 +08:00
Andy Cheng
34465fac89
Merge pull request #653 from andycheng123/strategy/supertrend
strategy: add supertrend strategy
2022-06-07 16:25:49 +08:00
Andy Cheng
ee26d6ce34 strategy: Persistence.Sync() after position change 2022-06-07 16:04:40 +08:00
Yo-An Lin
037f2949bd
Merge pull request #678 from andycheng123/fix/interact
interact: fix missing make()
2022-06-07 12:31:53 +08:00
c9s
32837d85a0
fix fmaker 2022-06-07 12:31:06 +08:00
c9s
46a008bea5
move batch insert back 2022-06-07 12:28:11 +08:00
Yo-An Lin
16e9535b8c
Merge pull request #638 from austin362667/strategy/f1
strategy: add fmaker
2022-06-07 12:24:26 +08:00
Andy Cheng
57aab937b3 interact: update test 2022-06-07 10:45:55 +08:00
Andy Cheng
9a086d2855 interact: use instance ID as signature 2022-06-07 10:40:15 +08:00
c9s
a4807d6594
fix tests 2022-06-07 01:21:27 +08:00
c9s
d7f9742360
binance: revert the start time filtering 2022-06-07 00:50:07 +08:00
c9s
53e74b6262
fix timezone issue for sqlite and mysql 2022-06-07 00:48:13 +08:00
c9s
b32b852303
service: fix FindMissingTimeRanges until check 2022-06-06 18:15:36 +08:00
zenix
c7eb065995 fix: close / rollback queries/transactions on error 2022-06-06 18:57:24 +09:00
Andy Cheng
58ec38d811 interact: update interact test 2022-06-06 17:43:25 +08:00
Andy Cheng
8410b1cc33 interact: update interact test 2022-06-06 17:34:39 +08:00
c9s
022775d0a2
service: use batch insert for kline 2022-06-06 17:21:31 +08:00
Andy Cheng
1f79e236ad interact: revert to id = strategy.ID() 2022-06-06 16:20:06 +08:00
Andy Cheng
3d9994706b interact: fix missing make() 2022-06-06 15:36:09 +08:00
c9s
dae4afec10
fix verify() time range 2022-06-06 14:58:26 +08:00
c9s
da6a209fd7
service: set PRAGMA for sqlite3 2022-06-06 14:53:37 +08:00
c9s
a6d18a87f5
fix: batch query exit issue
- remove errC case (this channel is closed earlier)
- add empty data range test case for finding missing time range
2022-06-06 13:25:11 +08:00
c9s
e1225d4127
add log insert option for sync 2022-06-06 12:24:18 +08:00
c9s
74f7e4181a
service: improve missing time range log 2022-06-06 12:15:06 +08:00
c9s
0a6deed305
service: fix QueryExistingDataRange 2022-06-06 11:46:18 +08:00
c9s
625bd0c5e4
fix order executor formatting 2022-06-06 07:23:16 +08:00
c9s
b209d94a9c
rename active order book constructor function 2022-06-06 06:57:25 +08:00
c9s
4dafa32e97
strategy: should always handle trade even if the strategy status is not running 2022-06-06 06:56:44 +08:00
c9s
2474aa777d
optimizer: fix parameter copy 2022-06-06 06:49:08 +08:00
c9s
43c2819d01
optimizer: copy param slice 2022-06-06 06:39:27 +08:00
c9s
0f6989af8b
service: avoid storing nil pointer to redis 2022-06-06 06:32:34 +08:00
c9s
a2cfea8acb
service: add stringer to TimeRange 2022-06-06 06:27:45 +08:00
c9s
be644bb91f
fix s.SyncKLineByInterval call 2022-06-06 06:24:25 +08:00
c9s
cb4c879942
backtest: copy the order object for updating status 2022-06-06 06:24:25 +08:00
c9s
f65b343ea6
service: clean up Verify method signature 2022-06-06 06:24:25 +08:00
c9s
41191c4db5
service: rewrite backtest verify 2022-06-06 06:24:24 +08:00
c9s
80d9c8a3be
update activeorderbook callback file 2022-06-06 06:03:49 +08:00
c9s
3786fc64f1
rename LocalActiveOrderBook to just ActiveOrderBook 2022-06-06 05:43:38 +08:00
c9s
1e27caa5e2
flashcrash: update local active book usage 2022-06-05 21:45:43 +08:00
c9s
1d340256ea
fix and simplify LocalActiveOrderBook 2022-06-05 18:12:26 +08:00
ankion
53f3df5ccf futures position no need to deduct fees 2022-06-05 16:33:08 +08:00
ankion
d90cf43d5a fix futures QuoteQuantity incorrect. 2022-06-05 16:33:08 +08:00
c9s
016ddfd8cd
pivotshort: also check isClosed 2022-06-05 13:14:17 +08:00
c9s
f883d42c58
pivotshort: avoid market sell again if position is already opened 2022-06-05 13:13:23 +08:00
c9s
629ae39095
fix var comparison 2022-06-05 13:09:32 +08:00
c9s
defff9b01d
pivotshort: add new found return value 2022-06-05 13:04:48 +08:00
c9s
f39ba4854d
pivotshort: add notify 2022-06-05 12:58:12 +08:00
c9s
74ee92832b
pivotshort: rename pivotBuffer to pivotLowPrices 2022-06-05 12:56:40 +08:00
c9s
32f324761e
pivotshort: market sell to open short 2022-06-05 12:55:36 +08:00
c9s
4bd322feb4
pivotshort: use notify and always collect trades 2022-06-05 12:51:45 +08:00
c9s
e7078edacd
pivotshort: add kline event handler and a todo 2022-06-05 12:48:54 +08:00
c9s
b20e1335c2
pivotshort: pull out market sell to a single method 2022-06-05 12:47:15 +08:00
c9s
f0578c5fa2
pivotshort: rename place order method 2022-06-05 12:40:41 +08:00
c9s
46b766857a
pivotshort: always collect trades after submitting orders 2022-06-05 12:40:08 +08:00
c9s
b9c32c7f7e
pivotshort: numLayers should be int 2022-06-05 12:37:35 +08:00
c9s
4b582830f0
remove timepoint map 2022-06-05 01:57:40 +08:00
c9s
c20e3fee4b
fix persistence unmarshalling issue 2022-06-05 01:48:56 +08:00
c9s
221a2d9dc7
fix persistence: calling type method on z zero value 2022-06-05 01:09:31 +08:00
c9s
39fcf1a51b
refactor sync command and add integration tests 2022-06-05 01:01:59 +08:00
c9s
425f8674d2
service: add kline partial sync 2022-06-04 19:15:11 +08:00
c9s
bf4d8d345e
service/backtest: implement backfill and time range scanner 2022-06-04 11:47:55 +08:00
c9s
9083881442
refactor exchange factory and solve the incorrect pkg import dependency from ftx 2022-06-04 11:47:55 +08:00
austin362667
9b8239abba pivotshort: add symbol name 2022-06-04 02:31:04 +08:00
austin362667
fcdc26e188 pivotshort: add init place order 2022-06-04 02:31:04 +08:00
c9s
6ceb54679a
add websocket log prefix 2022-06-04 00:39:24 +08:00
austin362667
5ca651a9b4 pivotshort: clean up field name 2022-06-03 23:28:48 +08:00
austin362667
af2d88d9a3 pivotshort: add immediate market sell 2022-06-03 23:23:26 +08:00
austin362667
9dab39849b pivotshort: clean up 2022-06-03 16:38:06 +08:00
austin362667
30be15dd34 pivotshort: add repay margin side effect 2022-06-03 15:48:49 +08:00
austin362667
2aac5bb273 pivotshort: improve post order & add margin 2022-06-03 15:48:49 +08:00
c9s
6936503cde
bollmaker: fix profit stats notification 2022-06-03 14:46:45 +08:00
c9s
3428aeba03
apply default exchange fee rate
fixes #566
2022-06-03 03:24:34 +08:00
c9s
4fc0687cf9
bollmaker: remove debug code 2022-06-03 03:14:19 +08:00
c9s
68d6e9e850
service: fix state loading (use correct ID method) 2022-06-03 03:10:50 +08:00
c9s
f7cdaff925
persistence: add store and load test case 2022-06-03 02:49:16 +08:00
c9s
7fce6a0fca
bollmaker: call persistence.Sync when position is changed 2022-06-03 02:44:00 +08:00
c9s
50d7d235a4
bollmaker: pull out functions 2022-06-03 02:44:00 +08:00
c9s
1a85299204
bollmaker: make detectPriceTrend simple function 2022-06-03 02:44:00 +08:00
Yo-An Lin
89c2e7de1e
Merge pull request #663 from c9s/fix/persistence-snapshot
test: add more test on Test_loadPersistenceFields
2022-06-03 02:09:52 +08:00
c9s
75bd5ffe32
ftx: fix kline time range check 2022-06-03 02:05:06 +08:00
c9s
55e9c7ee25
add more test on Test_loadPersistenceFields 2022-06-03 01:57:39 +08:00
c9s
0b6f7270ff
fix: drop IsZero 2022-06-03 01:15:08 +08:00
c9s
b1419a6f8b
ftx: add balance poller 2022-06-02 22:01:03 +08:00
c9s
3eb3a1f367
fix: ftx: add limit to ftx kline query 2022-06-02 21:51:22 +08:00
c9s
a7bd9239f2
fix: pull out time.now variable 2022-06-02 21:27:28 +08:00
c9s
32095e2741
fix: call abs on base for IsDust method 2022-06-02 21:06:52 +08:00
c9s
d27fee57ad
fix: do not load all trades into memory 2022-06-02 20:02:32 +08:00
c9s
d7c8b0b127
autoborrow: render balance map as SlackAttachment 2022-06-02 19:50:39 +08:00
Yo-An Lin
69c58ee38f
Merge pull request #656 from c9s/refactor/sync
refactor: drop unused function
2022-06-02 19:28:44 +08:00
c9s
5277098f70
add api .UnrealizedProfit and .IsDust method on Position 2022-06-02 18:05:35 +08:00
c9s
6a25f30b39
add IsLong and IsShort method on Position 2022-06-02 17:58:18 +08:00
c9s
e2f339e641
bollmaker: fix short position order 2022-06-02 17:55:14 +08:00
c9s
a2c7ebe90c
drop unused function 2022-06-02 17:24:54 +08:00
c9s
16322e19fe
service: set kline time to UTC 2022-06-02 16:53:17 +08:00
c9s
824951c3d5
batch: add remote query profiler 2022-06-02 16:52:34 +08:00
c9s
02a8bf4c8c
remove general rate limiter from batch query since it's already handled in the exchange 2022-06-02 16:52:33 +08:00
c9s
a878f35ca1
improve and fix kline sync 2022-06-02 16:52:33 +08:00
zenix
5faab1d55c fix: change from local timezone to UTC when do syncing 2022-06-02 17:12:17 +09:00
Yo-An Lin
38a6d8c813
Merge pull request #652 from c9s/refactor/sync
refactor/fix: withdraw sync
2022-06-02 14:03:54 +08:00
c9s
5d98674ab5
fix withdraw sync and improve withdraw string format 2022-06-02 13:56:24 +08:00
c9s
813166dd92
add TestWithdrawBatchQuery test 2022-06-02 13:56:24 +08:00
c9s
b36be80fd7
implement withdraw batch query 2022-06-02 13:56:23 +08:00
c9s
e11e0c97b8
types: update SupportedExchanges slice with correct types 2022-06-02 13:56:23 +08:00
c9s
c4f8b11f98
types: fix const type declaration 2022-06-02 13:56:23 +08:00
Andy Cheng
bf385899b9 strategy: use private for non-exported fields and functions 2022-06-02 13:47:16 +08:00
c9s
5527b3c48a
rename Withdrawal to Withdraw since it's a noun 2022-06-02 11:42:03 +08:00
c9s
c0f5c1963e
refactor and clean up withdraw history query method 2022-06-02 11:40:05 +08:00
c9s
e5ca6504f5
binance: add get_withdraw_history_request 2022-06-02 11:32:21 +08:00
Yo-An Lin
47098b08dd
Merge pull request #650 from austin362667/fix/persistence
Fix: Persistence Reflect IsZero
2022-06-02 02:32:36 +08:00
c9s
165b4fdb20
binance: remove loop from the withdraw history api 2022-06-02 02:31:46 +08:00
c9s
35ac5e1671
service/order: remove unused queryLast method 2022-06-02 02:13:42 +08:00
c9s
d6f144069d
service: refactor closed order sync method 2022-06-02 02:12:38 +08:00
c9s
f87a0ab316
autoborrow: add json tags 2022-06-02 01:53:22 +08:00
c9s
34e1b642d1
autoborrow: add exchange name to the margin action struct 2022-06-02 01:51:03 +08:00
c9s
4f842c521a
fix log message 2022-06-02 01:47:55 +08:00
c9s
8aec251a62
max: fix v3 loan/repay api path 2022-06-02 01:41:41 +08:00
c9s
ae8625da31
max: net asset should substract debt 2022-06-02 01:34:14 +08:00
c9s
92882f68f4
max: add borrow and repay todo 2022-06-02 01:28:33 +08:00
c9s
78f9c7d569
improve autoborrow checks 2022-06-02 01:27:04 +08:00
austin362667
f9bb2ae149 bbgo: fix persistence reflect IsZero check 2022-06-01 21:57:35 +08:00
c9s
4e666dee98
max: implement margin borrow and repay service on max 2022-06-01 20:44:24 +08:00
c9s
01822eee28
max: use v3 order api to submit orders 2022-06-01 20:34:20 +08:00
Yo-An Lin
b19ae857d3
Merge pull request #649 from c9s/feature/binance-margin-history
fix: max: fix QueryAccount for margin wallet
2022-06-01 19:58:54 +08:00
c9s
50accc5a2c
max: fix QueryAccount for margin 2022-06-01 19:56:10 +08:00
Yo-An Lin
bef73cf880
Merge pull request #648 from c9s/feature/binance-margin-history
feature: binance margin history sync support
2022-06-01 19:43:07 +08:00
c9s
b070952b32
service/sync: rewrite trade sync with syncTask 2022-06-01 19:40:30 +08:00
c9s
415450acb7
service/sync: add onLoad event support 2022-06-01 19:40:29 +08:00
c9s
fb63346732
service/reflect: add more debug logs 2022-06-01 19:40:29 +08:00
c9s
dfe29e07e7
service/margin: fix query ordering 2022-06-01 19:40:29 +08:00
c9s
991d13cb32
cmd/sync: support multiple session names 2022-06-01 19:40:29 +08:00
c9s
1a85e62993
service: integrate margin service into the sync service 2022-06-01 19:40:29 +08:00
c9s
5bb98734fb
batch: set jump if empty field 2022-06-01 19:40:29 +08:00
c9s
484fc62892
batch: set jump if empty field 2022-06-01 19:40:29 +08:00
c9s
118dc07e10
service: fix reflect rows scan 2022-06-01 19:40:29 +08:00
c9s
5a4a2db66f
service: add time function 2022-06-01 19:40:29 +08:00
c9s
5eaa4706f0
binance: set exchange field for margin records 2022-06-01 19:40:29 +08:00
c9s
63ad635f62
cmd: rewrite sync command 2022-06-01 19:40:29 +08:00
c9s
cf19ed6f26
refactor environment sync method 2022-06-01 19:40:29 +08:00
c9s
f4e7f4f6f6
add margin history entry in config 2022-06-01 19:40:29 +08:00
c9s
bdc76e8db6
types: add gid field 2022-06-01 19:40:29 +08:00
c9s
279e4d8682
service: refactor sync task 2022-06-01 12:02:15 +08:00
Andy Cheng
205921ea42 strategy: remove HasTradableBase() 2022-06-01 10:54:13 +08:00
Andy Cheng
cd96c01131 strategy: use Market.IsDustQuantity instead 2022-06-01 10:51:57 +08:00
Andy Cheng
237d1205e8 strategy: check update balance response in calculateQuantity 2022-06-01 10:26:04 +08:00
Yo-An Lin
a56bec9dc9
Merge pull request #644 from c9s/feature/binance-margin-history
feature: sync binance margin history into db
2022-05-31 17:48:12 +08:00
c9s
f116b7b2d0
service: add margin liqudiation sync task 2022-05-31 17:43:17 +08:00
c9s
bf92e28461
service: implement margin service for syncing margin related data 2022-05-31 17:43:17 +08:00
c9s
7601f08786
compile and update migration package 2022-05-31 17:32:55 +08:00
c9s
79fbad1266
migrations: add margin_liquidations table 2022-05-31 17:31:15 +08:00
Andy Cheng
6285e145a7 strategy: margin side effect 2022-05-31 15:46:55 +08:00
zenix
a2a186cfbb feature: add emv indicator, fix: sma 2022-05-31 16:28:38 +09:00
Andy Cheng
3421423cd6 strategy: update balance for exchanges like FTX 2022-05-31 14:30:37 +08:00
Andy Cheng
a5124c743f strategy: supertrend strategy TP/SL 2022-05-31 12:53:14 +08:00
c9s
c3f2c9eb4a
batch: add margin loan/repay/interest batch query 2022-05-31 01:19:38 +08:00
c9s
e66eb08db4
batch: refactor batch query 2022-05-31 00:59:33 +08:00
c9s
7add014a2b
service: use upper case sql keywords 2022-05-30 18:11:17 +08:00
c9s
f29e8bd6d2
service: use reflect to generate insert sql 2022-05-30 18:08:54 +08:00
c9s
2dc825f654
types: add db tag 2022-05-30 18:08:54 +08:00
c9s
d72b56f51f
binance: refine liquidation history api 2022-05-30 18:08:54 +08:00
Andy Cheng
d72a4e8e94 strategy: supertrend strategy config example 2022-05-30 16:48:07 +08:00
Andy Cheng
756284378b strategy: supertrend strategy control 2022-05-30 16:35:10 +08:00
Andy Cheng
44469ed3aa strategy: supertrend position control 2022-05-30 16:26:17 +08:00
Andy Cheng
07fe68d740 strategy: Validate() 2022-05-30 16:22:13 +08:00
Andy Cheng
0e1e5369f2 strategy: leverage parameter 2022-05-30 16:07:36 +08:00
Andy Cheng
1d24379c17 strategy: refactor supertrend sconfig 2022-05-30 14:52:51 +08:00
Zenix
8652b4e043
Merge pull request #633 from zenixls2/fix/ewo_entry
Fix/ewo entry, backtest
2022-05-30 15:47:46 +09:00
zenix
e3a8ef4e69 fix: statistics on entry/exit on signal changes, fix position check 2022-05-30 12:45:52 +09:00
austin362667
c904f9f0f7 strategy: add fmaker
fmaker: cleanup
2022-05-29 21:39:11 +08:00
c9s
61a53947ee
binance: re-organize convert functions 2022-05-29 12:03:21 +08:00
c9s
11075b0d1a
cmd: add marginInterestsCmd 2022-05-29 12:01:20 +08:00
c9s
4a4699a4bc
cmd: add margin repays cmd 2022-05-29 11:53:36 +08:00
c9s
70f0dccb9f
binance: convert loans and repays to global types 2022-05-29 11:52:25 +08:00
c9s
409ad9b75c
binance: adjust margin history interface 2022-05-29 01:42:08 +08:00
c9s
f58f44ffd8
binance: refactor query methods 2022-05-29 01:21:43 +08:00
c9s
4c30fce917
binance: add GetMarginInterestHistoryRequest api 2022-05-29 01:13:33 +08:00
c9s
e72f8bcd15
binance: fix and rename margin liquidation history request 2022-05-29 00:57:46 +08:00
c9s
1ab10eb574
binance: fix and add loan/repay history test 2022-05-29 00:52:22 +08:00
c9s
aec9de8dd6
types: define global margin history types 2022-05-28 17:34:29 +08:00
c9s
4f0ac41850
max: generate missing files 2022-05-28 16:52:02 +08:00
c9s
fcdf0f8168
max: rename methods 2022-05-28 16:48:51 +08:00
c9s
753d7a8d5e
max: rename requests 2022-05-28 16:47:41 +08:00
c9s
cef002ccb6
move type alias 2022-05-28 16:06:16 +08:00
Yo-An Lin
5c5a88fe0e
Merge pull request #636 from c9s/feature/max-margin-wallet
fix: max: fix trades/orders parsing
2022-05-27 19:55:22 +08:00
c9s
887fe09b44
max: add margin level info the account 2022-05-27 19:48:03 +08:00
c9s
c891cc56e3
max: fix trades/orders parsing 2022-05-27 19:48:03 +08:00
Andy Cheng
39b0013513 strategy: supertrend strategy tp/sl 2022-05-27 18:24:08 +08:00