Commit Graph

5573 Commits

Author SHA1 Message Date
Edwin
54e7065d8a pkg/exchange: implement trade event 2023-08-10 19:58:27 +08:00
Edwin
affff32599 pkg/exchange: get fee rate before connect 2023-08-10 17:57:47 +08:00
Edwin
509f9ac8ca pkg/types: add BeforeConnect hook function 2023-08-10 15:26:54 +08:00
Edwin
0b03336fb0 pkg/exchange: support GetFeeRates on bybit exchange 2023-08-10 15:26:51 +08:00
Edwin
ace2c55a17 exchange/bybit: add fee rate restful api 2023-08-10 15:02:30 +08:00
bailantaotao
6379cab65e
Merge pull request #1277 from bailantaotao/edwin/add-kline-api
FEATURE: [bybit] add k line api
2023-08-10 11:44:28 +08:00
Edwin
4cee22ce31 pkg/exchage: support k line websocket event 2023-08-10 11:07:13 +08:00
Edwin
e9d0ce5bbf pkg/exchage: support k line rest api 2023-08-10 11:07:10 +08:00
c9s
ecc0928ef5
Merge pull request #1281 from c9s/c9s/strategy-deposit2transfer
FIX: [deposit2transfer] add lastAssetDepositTimes for immediate success deposits
2023-08-09 16:41:29 +08:00
c9s
6103a9350f
deposit2transfer: add lastAssetDepositTimes for immediate success deposits 2023-08-09 15:54:28 +08:00
bailantaotao
24d240b1f3
Merge pull request #1279 from bailantaotao/edwin/add-query-acct
FEATURE: [bybit] support query account/balance api
2023-08-09 15:33:04 +08:00
Alan.sung
1c5d2dc759 add QueryOrder in okex exchange.go 2023-08-09 15:05:26 +08:00
Edwin
65b06ff401 pkg/exchange: add query account function 2023-08-09 14:05:57 +08:00
Edwin
dfead5ebed pkg/exchange: add query account balance api 2023-08-09 14:05:57 +08:00
Edwin
8c22863334 pkg/exchange: mv BalanceEvent to bybitapi and rename to WalletBalances 2023-08-09 14:05:55 +08:00
c9s
4ed402b775
max: update deposit states and add more fields to deposit 2023-08-08 20:51:48 +08:00
c9s
b711e1e439
Merge pull request #1275 from c9s/c9s/strategy-deposit2transfer
FEATURE: [strategy] add deposit2transfer tool
2023-08-08 15:13:06 +08:00
Edwin
b27395f6f4 pkg/exchange: avoiding GC panic caused by a rapid creation/removal slice of pointers 2023-08-08 14:11:19 +08:00
c9s
25298720d0
max: implement TransferMarginAccountAsset on max 2023-08-08 13:16:11 +08:00
c9s
5460ebdbf4
max: add margin transfer request 2023-08-08 12:49:05 +08:00
c9s
ece8cacd9e
deposit2transfer: use watchingDeposits instead of just deposits 2023-08-08 12:38:59 +08:00
c9s
4a28843a0a
deposit2transfer: fix mutex lock 2023-08-08 12:38:23 +08:00
c9s
073c4562fd
deposit2transfer: refactor deposit check and add more logs 2023-08-08 12:23:17 +08:00
c9s
29727c12be
add deposit2transfer config 2023-08-08 12:14:14 +08:00
c9s
423cb27288
deposit2transfer: add more log messages 2023-08-08 12:08:14 +08:00
c9s
241ce657c3
binance: remove isMargin check 2023-08-08 12:01:30 +08:00
c9s
c7845477b4
deposit2transfer: remove binance spot struct field 2023-08-08 11:58:36 +08:00
c9s
33b3d0ff57
types: use consistent receiver for MarginSettings 2023-08-08 11:48:06 +08:00
Edwin
f664ef2262 pkg/exchange: add order event 2023-08-08 11:42:02 +08:00
bailantaotao
5349e5afbe
Merge pull request #1274 from bailantaotao/edwin/add-account-info
FEATURE: [bybit] add balance snapshot event
2023-08-08 11:41:02 +08:00
c9s
c55a6a46af
deposit2transfer: check confirmation for deposits 2023-08-08 11:20:17 +08:00
c9s
4c4b9db47a
types,binance: add confirmation and unlockConfirm fields to Deposit 2023-08-08 11:20:17 +08:00
c9s
5f40dfa462
deposit2transfer: scan deposit history 2023-08-08 11:20:17 +08:00
c9s
9248f8ac24
binance: define DepositStatus for binance 2023-08-08 11:20:17 +08:00
c9s
9346e7d1f6
binance: replace emptyTime with IsZero 2023-08-08 11:20:17 +08:00
c9s
0118f33bfc
binance: finalize TransferMarginAccountAsset method 2023-08-08 11:20:17 +08:00
c9s
8b1cefc699
binance: integerate isolated margin / cross margin transfer 2023-08-08 11:20:17 +08:00
c9s
92691eda24
binanceapi: add margin transfer api 2023-08-08 11:20:17 +08:00
c9s
0c6b68c4f6
add deposit2transfer strategy 2023-08-08 11:20:17 +08:00
c9s
85201d0b57
Merge pull request #1271 from c9s/c9s/strategy-convert
REFACTOR: apply market.GreaterThanMinimalOrderQuantity on both convert and xalign
2023-08-08 11:14:08 +08:00
Edwin
8b68354d89 pkg/exchange: add balance snapshot event 2023-08-08 10:04:25 +08:00
Edwin
3e4e46de20 pkg/exchange: to de-pointer the value in WsOpEvent and fix test assertion 2023-08-07 15:59:50 +08:00
Edwin
84fa19afee pkg/exchange: add auth function for ws 2023-08-07 14:58:20 +08:00
bailantaotao
a8697abf93
Merge pull request #1268 from bailantaotao/edwin/stream-query-book
FEATURE: [bybit] implement order book streaming
2023-08-07 11:29:10 +08:00
c9s
c3cce05bdd
xalign: apply market.GreaterThanMinimalOrderQuantity on xalign 2023-08-05 16:49:25 +08:00
c9s
8b6a8aeb7b
convert: move moq check/adjustment to types.Market 2023-08-05 16:39:03 +08:00
c9s
ce8063654d
tradingutil: add test on CollectTradeFee 2023-08-05 16:38:46 +08:00
c9s
616e9397d4
Merge pull request #1270 from c9s/c9s/strategy-convert
FEATURE: [strategy] Add convert strategy
2023-08-05 02:46:56 +08:00
c9s
4d293121d7
convert: fix pending quantity collector with trade query 2023-08-05 02:37:53 +08:00
c9s
bc8fe22e70
convert: fix collectPendingQuantity and use graceful order cancel 2023-08-05 02:15:16 +08:00
c9s
430b22f5e9
cmd: register convert strategy 2023-08-05 02:00:22 +08:00
c9s
951672fc82
improve cancelOrders method 2023-08-05 02:00:07 +08:00
c9s
eaaab914e0
refactor order executor accessors 2023-08-05 01:59:52 +08:00
c9s
c605761c4f
add tradingutil package 2023-08-05 01:59:36 +08:00
c9s
348c8a61e4
add convert strategy 2023-08-05 01:59:20 +08:00
c9s
7d4d2f3e41
types: add truncate quote quantity method 2023-08-05 01:59:04 +08:00
c9s
7060fd4ecb
bbgo: add simple order executor 2023-08-04 18:02:24 +08:00
Edwin
a6047f629d pkg/exchange: implement bybit stream ping 2023-08-04 18:00:50 +08:00
Andy Cheng
1130417401
fix/supertrend: use strconv instead of fmt 2023-08-04 11:07:20 +08:00
Edwin
e1bae5dba0 pkg/exchange: implement bybit stream ping 2023-08-02 17:55:20 +08:00
Edwin
5064615df8 pkg/exchange: add custom heart beat func to StandardStream 2023-08-02 17:47:18 +08:00
c9s
e61db95bd8
types: exit ping worker when error is happened 2023-08-02 14:07:35 +08:00
c9s
d4abc16959
bump version to v1.51.1 2023-08-02 11:04:51 +08:00
c9s
2af45f73b6
compile and update migration package 2023-08-02 11:04:51 +08:00
c9s
71d86aa483
core: add trade to the trade store when order is not matched 2023-08-02 00:41:58 +08:00
c9s
7adc786c8a
Merge pull request #1259 from c9s/c9s/fix-trade-deadlock
FIX: core: fix trade collector dead lock
2023-08-01 22:41:10 +08:00
c9s
c0e315fafe
core: fix trade collector dead lock 2023-08-01 22:22:18 +08:00
c9s
5bb2a50f21
fix lint issues 2023-08-01 20:17:20 +08:00
c9s
f095a1ab71
core: fix trade collector dead lock 2023-08-01 20:11:33 +08:00
bailantaotao
ae61e10c6a
Merge pull request #1255 from bailantaotao/edwin/query-trades
FEATURE: [bybit] add query trade api
2023-08-01 18:02:29 +08:00
Edwin
4363f0ae7b pkg/exchange: add query trade api 2023-08-01 16:31:49 +08:00
c9s
cfd5884350
Merge remote-tracking branch 'origin/v1.50' 2023-08-01 13:23:04 +08:00
c9s
54e0e1024c
Merge pull request #1254 from c9s/v1.50
merge back v1.50 into main
2023-07-31 20:24:00 +08:00
c9s
4560b47556
grid2: only for positive non-zero fee 2023-07-31 18:12:28 +08:00
c9s
43b8e7870d
grid2: ignore discounted trades 2023-07-31 18:06:20 +08:00
c9s
f2109afa0e
add last 30 days to loose date support 2023-07-31 17:54:49 +08:00
Alan.sung
b0ccc7e51b use &PublicDataService{} to create it as a pointer object and rename ser to srv 2023-07-31 11:00:38 +09:00
Edwin
86c643b513 pkx/exchange: fix batch query trade missing time range 2023-07-28 22:54:48 +08:00
c9s
4eefe72cb6
service: fix db reflection 2023-07-28 14:41:36 +08:00
bailantaotao
7eb6e402ca
Merge pull request #1252 from bailantaotao/edwin/query-closed-order
FEATURE: [bybit] query closed order
2023-07-28 14:40:38 +08:00
Edwin
d2ad504579 pkg/exchange: add QueryClosedOrders 2023-07-28 10:15:08 +08:00
Edwin
f25ab567eb pkg/exhcange: return err on max queryClosedOrdersByLastOrderID 2023-07-27 18:35:58 +08:00
Edwin
1760a5b8d6 pkg/exchange: try to parse order id to integer 2023-07-27 18:09:43 +08:00
Edwin
d8b8e7f2ac pkg/exchange: rename OpenOrders to Orders 2023-07-27 17:35:33 +08:00
c9s
b02ac837ea
max: handle SelfTradeBidFeeDiscounted 2023-07-27 16:28:54 +08:00
Edwin
574d7c0c74 pkg/exchange: rm redundant prefix 2023-07-27 10:31:24 +08:00
Edwin
5105046053 pkg/exchange: support cancel order 2023-07-26 22:24:20 +08:00
Edwin
151e8d2acf pkg/exchange: support place order for bybit 2023-07-26 21:44:49 +08:00
bailantaotao
3fd66199d7
Merge pull request #1248 from bailantaotao/edwin/add-query-open-orders
pkg/exchange: add QueryOpenOrders API for bybit
2023-07-26 15:12:37 +08:00
c9s
cddb7874ce
maxapi: set user agent 2023-07-26 14:35:33 +08:00
Edwin
6d4deb54cc pkg/exchange: add QueryOpenOrders API for bybit 2023-07-26 14:18:02 +08:00
bailantaotao
ff78637c8f
Merge pull request #1244 from bailantaotao/edwin/add-ticker
FEATURE: support QueryTickers API on bybit
2023-07-25 20:35:56 +08:00
c9s
1d24af13a8
core: document order store options 2023-07-25 17:50:48 +08:00
Edwin
b71030c5db pkg: return err if rate limit err 2023-07-25 15:09:57 +08:00
Edwin
ef8d1c7046 pkg/exchange: support QueryTickers API on bybit 2023-07-25 15:02:38 +08:00
c9s
fcca3f6432
types: add fee discounted field to the global trade struct 2023-07-25 14:57:10 +08:00
c9s
4de82ccdff
max: use types.MillisecondTimestamp for UpdateTime field 2023-07-25 13:37:31 +08:00
c9s
f5feb72355
max: add fee_discounted to Trade struct for RESTful api 2023-07-25 13:35:08 +08:00
c9s
e41ad75776
add httptesting pkg 2023-07-25 11:32:53 +08:00
c9s
8a3c89ba91
autoborrow: fix marginAsset.Low calculation 2023-07-25 00:27:43 +08:00
c9s
6691229809
fixedpoint: fix default fixedpoint conversion 2023-07-25 00:18:36 +08:00
c9s
4cb9ff569a
autoborrow: improve available balance checking 2023-07-25 00:16:05 +08:00
c9s
b7c9ef7983
types: add NotZero() method to filter non-zero balances 2023-07-25 00:11:08 +08:00
c9s
bfb1165304
autoborrow: fix debt checking condition 2023-07-24 23:01:22 +08:00
c9s
a2a062e95b
autoborrow: use debt instead of using b.Borrowed 2023-07-24 22:57:02 +08:00
bailantaotao
157de4b2ee
Merge pull request #1243 from bailantaotao/edwin/add-query-markets
FEATURE: pkg/exchange: add query market to bybit exchange
2023-07-24 21:52:31 +08:00
Edwin
3c32acc3ed pkg/exchange: add query market to bybit 2023-07-24 20:18:44 +08:00
c9s
a5a9512ef1
autoborrow: check available 2023-07-24 18:23:09 +08:00
c9s
f014213c85
autoborrow: log balances 2023-07-24 18:13:53 +08:00
c9s
106e98afaa
autoborrow: add more logs 2023-07-24 18:05:32 +08:00
c9s
8d8852ec00
bump version to v1.51.0 2023-07-24 17:03:52 +08:00
c9s
afc5dbb951
Merge remote-tracking branch 'origin/v1.50' 2023-07-24 17:02:08 +08:00
c9s
c42ad19955
Merge pull request #1241 from c9s/c9s/max-add-fee-discounted-field
FEATURE: [max] add fee discounted field support
2023-07-24 16:58:40 +08:00
c9s
c114477340
Merge pull request #1242 from c9s/c9s/fix-max-withdrawal-api
FIX: [max] fix MAX withdrawal address parameter name
2023-07-24 16:58:21 +08:00
bailantaotao
06a741e615
Merge pull request #1237 from bailantaotao/edwin/add-new-exchange-account-api
FEATURE: add new exchange Bybit GetAccountInfo/GetInstrumentsInfo api
2023-07-24 16:58:12 +08:00
Edwin
ac5e2cf712 pkg, types: add bybit to factor and update readme 2023-07-24 15:51:44 +08:00
Edwin
b45fdea99a pkg/exchange: add get account info and instruments info api for bybit 2023-07-24 15:51:41 +08:00
c9s
16c62bbcba
maxapi: fix max withdrawal api 2023-07-24 15:28:11 +08:00
c9s
9c20215f41
max: use fixedpoint.Value for field parsing 2023-07-24 15:00:03 +08:00
c9s
5f2ead4ffd
maxapi: parse fd field and optimize trade snapshot parsing 2023-07-24 14:57:50 +08:00
c9s
3bd821261f
tri: fix lint issue 2023-07-22 18:06:53 +08:00
c9s
2abd84aec9
core: pull out RecoverTrade method 2023-07-22 17:57:02 +08:00
c9s
fad8642a59
xmaker: fix message 2023-07-22 17:34:09 +08:00
c9s
c13a5cdf6e
core: add recover logs for the recovered trade count 2023-07-22 17:32:24 +08:00
c9s
70439f3fd9
xmaker: add tradeScanOverlapBufferPeriod time 2023-07-22 17:30:24 +08:00
c9s
941067670e
xmaker: pull out trade recover go routine 2023-07-22 17:29:16 +08:00
c9s
df1067d309
grid2: simplify removeDuplicatedPins 2023-07-22 11:45:30 +08:00
c9s
461735e043
grid2: add remove duplicated pins and pull out filter price prec func 2023-07-22 11:36:04 +08:00
c9s
b250bf94bc
rsicross: add more conditions to rsicross 2023-07-22 11:23:09 +08:00
Alan.sung
cba5663fac add unit test for okex exchange 2023-07-21 17:05:19 +08:00
c9s
a45c241b9b
types: turn off network error log 2023-07-20 17:05:53 +08:00
c9s
a3c16a4117
bbgo: use backoff for graceful cancel 2023-07-20 12:45:23 +08:00
c9s
f1a105cc06
fix iterate test 2023-07-20 12:45:23 +08:00
c9s
1dae711d33
fix trade collector race condition and infinite iterate 2023-07-20 12:45:23 +08:00
c9s
93d10eba5a
autoborrow: improve logging details 2023-07-19 16:58:51 +08:00
gx578007
bded2edaf2
FIX: [grid2] fix upper pin 2023-07-18 16:07:55 +08:00
gx578007
d99aa1f013 FIX: [grid2] fix upper pin 2023-07-18 15:54:23 +08:00
Andy Cheng
e37edb3056
Merge pull request #1198 from andycheng123/feature/profit-tracker
FEATURE: add ProfitStatsTracker
2023-07-18 11:40:26 +08:00
c9s
8f62665cfd
autoborrow: add another skip log 2023-07-18 11:08:34 +08:00
c9s
e6958f44f0
autoborrow: fix log message 2023-07-18 11:04:43 +08:00
c9s
a0145934ec
autoborrow: show min debt ratio in the message 2023-07-18 11:04:03 +08:00
c9s
3144b640ee
autoborrow: update account after repaying the debts 2023-07-18 11:01:21 +08:00
Andy Cheng
1773c8d155
fix/linregmaker: use float64() to output parameters 2023-07-18 11:00:02 +08:00
Andy Cheng
b9734bca0c
fix/linregmaker: missing line 2023-07-18 10:56:42 +08:00
c9s
84ec320601
autoborrow: show debt and total for debt ratio 2023-07-18 10:54:39 +08:00
c9s
844bd8be87
bitget: add account transfers request 2023-07-17 16:38:42 +08:00
Andy Cheng
192d958adc
improve/linregmaker: use strconv 2023-07-17 12:22:09 +08:00
Andy Cheng
08d8519e67
improve/profitStatsTracker: use SMA instead of SMA2 2023-07-17 12:10:48 +08:00
Andy Cheng
e5254e6446
improve/linregmaker: add profit report 2023-07-17 11:45:37 +08:00
Andy Cheng
bc4eae5e39
improve/supertrend: Switch of outputting patameters in profit report 2023-07-17 11:19:10 +08:00
c9s
f8051b3f2b
autoborrow: fix margin warning format 2023-07-14 13:22:42 +08:00
c9s
a9d0242a9d
strategy/autoborrow: add margin level alert 2023-07-14 13:19:54 +08:00
c9s
b9616a0805
add TradeCollector.Process() log message 2023-07-12 17:16:46 +08:00
c9s
885c58f77e
core/tradecollector: reduce critical section 2023-07-12 16:47:51 +08:00
c9s
baf431d7b6
riskcontrol: log on release position order 2023-07-12 16:17:22 +08:00
c9s
d6ade1f2fd
autoborrow: use context timeout handling 2023-07-12 15:07:51 +08:00
c9s
7781d5c70f
autoborrow: few improvements:
- return debt once and update the account
- add alert slack mentions
2023-07-12 15:01:15 +08:00
c9s
c54031b0e8
Merge pull request #1229 from c9s/c9s/indicator-cci-v2 2023-07-11 14:14:17 +08:00
c9s
b1c1caa6af
tri: load test data from static file 2023-07-11 14:07:07 +08:00
c9s
ce481ba52d
rewrite cci indicator in v2 indicator 2023-07-11 14:07:07 +08:00
Andy Cheng
e161deba25
improve/profitStatsTracker: use SMA v2 2023-07-11 11:13:13 +08:00
Andy Cheng
6e54972304
improve/profitStatsTracker: use CsvFormatter interface 2023-07-11 10:48:29 +08:00
Andy Cheng
1a90cd0322
improve/profitStatsTracker: rename InitOld() to InitLegacy() 2023-07-11 10:48:29 +08:00
Andy Cheng
928a77cb8b
improve/profitStatsTracker: use strconv instead of Sprintf() 2023-07-11 10:48:29 +08:00
Andy Cheng
2a80d708af
ref/profitStatsTracker: TradeCollector is move to core pkg 2023-07-11 10:48:29 +08:00
Andy Cheng
4c1639cf00
fix/profitStatsTracker: market is initiated after strategy Subscribe() 2023-07-11 10:48:28 +08:00
Andy Cheng
2ccce12cbf
improve/profitStatsTracker: temporarily remove lines relate to time in profit stats 2023-07-11 10:48:28 +08:00
Andy Cheng
ae7ae27d82
improve/profitStatsTracker: rename ProfitTracker to ProfitStatsTracker 2023-07-11 10:48:28 +08:00
Andy Cheng
bcbb27de79
improve/profitTracker: subscribe kline in strategy Subscribe() 2023-07-11 10:48:28 +08:00
Andy Cheng
80170e0397
improve/profitTracker: do not bind in order executor 2023-07-11 10:48:28 +08:00
Andy Cheng
5513330816
feature/profitTracker: fix bugs 2023-07-11 10:48:28 +08:00
Andy Cheng
027acfe3b5
feature/profitTracker: integrate profit report with profit tracker 2023-07-11 10:48:28 +08:00
Andy Cheng
a197352c6e
feature/profitTracker: use profitTracker in Supertrend strategy 2023-07-11 10:48:28 +08:00
Andy Cheng
57cdbb1d77
feature/profitTracker: add AddTrade() 2023-07-11 10:48:28 +08:00
Andy Cheng
d5e194ca80
feature/profitTracker: prototype 2023-07-11 10:48:27 +08:00
c9s
ee9a3269b6
indicator/v2: add SMA example 2023-07-11 10:31:20 +08:00
c9s
66dd5507d1
rename SMA2 to just SMA 2023-07-11 10:31:20 +08:00
c9s
1da94f55e9
Merge pull request #1226 from c9s/c9s/base-strategy
REFACTOR: pull out base strategy struct
2023-07-10 17:50:12 +08:00
c9s
630b0d476d
scmaker: use dot import to use v2 indicator DSL 2023-07-10 17:17:46 +08:00
c9s
5853434aec
all: move v2 indicator to indicator/v2 2023-07-10 17:17:46 +08:00
c9s
f71fcdee23
Merge pull request #1225 from c9s/c9s/nested-persistence
FEATURE: support nested persistence
2023-07-10 15:29:24 +08:00
c9s
3293866a6c
common: pull out RiskController 2023-07-10 15:27:36 +08:00
c9s
3b6cff8dc7
strategy: move risk control to common.Strategy 2023-07-10 15:24:07 +08:00
c9s
14664188a0
Merge pull request #1224 from c9s/c9s/google-spreadsheet
FEATURE: add google spreadsheet service support
2023-07-10 11:10:49 +08:00
c9s
12bb22ae87
rsicross: remove unused funcs 2023-07-09 21:24:56 +08:00
c9s
5c88abe72f
add rsicross strategy 2023-07-09 21:23:42 +08:00
c9s
7c2de46273
pkg: rename base -> common 2023-07-09 19:55:36 +08:00
c9s
c9c058e717
base: simplify naming 2023-07-09 16:04:27 +08:00
c9s
62d394d183
all: moving common strategy functionality to strategy/base 2023-07-09 15:48:07 +08:00
c9s
0891859b98
dynamic: support nested persistence 2023-07-09 15:11:09 +08:00
c9s
5962742b43
all: integrate google spread sheet service 2023-07-09 13:17:39 +08:00
c9s
b47da70909
Merge pull request #1223 from c9s/c9s/google-spreadsheet 2023-07-07 18:35:23 +08:00
c9s
e41d720867
service/google: support reflect conversion 2023-07-07 14:52:25 +08:00
c9s
9bec294aa1
service/google: fix appendCells call 2023-07-07 13:36:31 +08:00
c9s
f9eba64816
xfunding: always sync funding fee 2023-07-06 16:02:37 +08:00
c9s
dc16e0c299
xfunding: reset LastFundingFeeTime 2023-07-06 15:58:42 +08:00
c9s
e8922a4c3a
xfunding: support transferIn with zero quantity 2023-07-05 17:18:28 +08:00
c9s
f505dda80f
xfunding: handle reset transfer when starting up 2023-07-05 16:59:10 +08:00
c9s
f6a3be6ff5
xfunding: improve checkAndRestorePositionRisks 2023-07-05 16:48:19 +08:00
c9s
bd347d5aa5
xfunding: log positionRisks 2023-07-05 16:48:19 +08:00