Commit Graph

835 Commits

Author SHA1 Message Date
c9s
d27fee57ad
fix: do not load all trades into memory 2022-06-02 20:02:32 +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
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
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
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
13bf5d69a3
use types.Interval instead of string 2022-05-19 10:04:03 +08:00
c9s
b5f9f86944
define DefaultBacktestAccount 2022-05-17 18:45:06 +08:00
c9s
6c0165afe4
add report index file 2022-05-17 18:10:37 +08:00
zenix
71fe6c2d26 feature: SLTP from bookticker. fix: bookTicker typename, depth buffer error message 2022-05-12 19:43:04 +09:00
c9s
11d0823782
cmd: refactor back-test command 2022-05-11 13:59:44 +08:00
c9s
5f68064ac6
pull out writeJsonFile function 2022-05-10 18:27:23 +08:00
c9s
7b17b1a757
integrate state recorder 2022-05-10 13:31:23 +08:00
c9s
0780dafdc3
add IsBackTesting method for checking environment mode 2022-05-09 18:58:09 +08:00
c9s
82c7c024ce
bbgo: add persistence Sync api 2022-05-05 18:18:38 +08:00
c9s
f3691489dd
add state key as the prefix 2022-05-05 18:18:38 +08:00
c9s
7378c63cb7
cmd: call SaveState and LoadState for normal run 2022-05-05 14:28:42 +08:00
c9s
57c43936d6
ignore service.ErrPersistenceNotExists error 2022-05-05 14:04:44 +08:00
c9s
57a9647401
add more test case and simplify return stmt 2022-05-05 13:16:46 +08:00
c9s
4cf1f0a91a
add func type StructFieldIterator 2022-05-05 13:06:02 +08:00
c9s
30c85d2969
pull out callID method call 2022-05-05 13:05:01 +08:00
c9s
21f81dec29
implement reflect-based persistence restore and load 2022-05-05 12:53:48 +08:00
c9s
18eab1fbd3
move graceful shutdown to a single file 2022-05-05 09:56:21 +08:00
c9s
36c764efa9
refactor balance, asset and remove price cache check 2022-05-04 17:17:09 +08:00
c9s
450517d159
bbgo: do not write trade when writing position 2022-05-04 16:21:53 +08:00
c9s
0e417f6f71
xnav: rename assets to allAssets 2022-05-04 16:21:53 +08:00
c9s
8a93f0921f
add more margin info columns 2022-05-04 14:40:52 +08:00
c9s
95f7d85183
bbgo: pass price time into the asset conversion function 2022-05-04 14:23:46 +08:00
c9s
2c70509ee8
add recordAsset method 2022-05-03 19:26:52 +08:00
c9s
946bbdbca3
backtest: rename backtest.account to backtest.accounts 2022-05-03 12:18:40 +08:00
c9s
fa2eb87268
fix: sync can be nil 2022-05-02 11:55:40 +08:00
c9s
2bdcf2266d
fix default sync logic 2022-05-02 10:39:59 +08:00
c9s
486cf50a9c bbgo: fix init band width setup 2022-05-01 01:12:57 +08:00
c9s
044470377b
avoid using the iterator variable 2022-04-27 17:13:58 +08:00
c9s
1c1fbb1633
bbgo: document strategy id and pnl field 2022-04-27 13:30:07 +08:00
c9s
5edaa9708c
bbgo: fix margin order/trade sync 2022-04-27 13:25:42 +08:00
Andy Cheng
8c353421d8 interact: Remove status from strategy signature 2022-04-26 21:05:26 +08:00
Andy Cheng
1a13826505 interact: refactor generateStrategyButtonsForm() 2022-04-26 19:11:50 +08:00
Andy Cheng
eb1beb05d1 interact: rename functions to private functions 2022-04-26 18:32:41 +08:00
Andy Cheng
6b62f27155 feature: make callback vars start with lowercase 2022-04-26 18:29:22 +08:00
Andy Cheng
61b6755518 interact: GetStrategySignatures() returns map[string]SingleExchangeStrategy instead of slice of strategy signatures 2022-04-26 18:29:22 +08:00
Andy Cheng
f6ec931bed feature: use callbackgen 2022-04-26 18:29:22 +08:00
Andy Cheng
cbf6bf78bc feature: make FilterStrategyByInterface a simple function 2022-04-26 18:29:22 +08:00
Andy Cheng
ecc63f743f feature: split strategy controller interface into several smaller ones 2022-04-26 18:29:21 +08:00
Andy Cheng
64766c48f3 feature: revert position closer and position reader back 2022-04-26 18:29:21 +08:00
Andy Cheng
78a8c2aaaf feature: mix embeded struct and callback in strategy controller 2022-04-26 18:29:21 +08:00
Andy Cheng
57fdc9b120 feature: adapt new strategy controller in support strategy 2022-04-26 18:29:21 +08:00
Andy Cheng
6228cddbec feature: adapt new strategy controller in interact 2022-04-26 18:29:21 +08:00
Andy Cheng
bb2bce4721 feature: strategy controller 2022-04-26 18:29:21 +08:00
Andy Cheng
85ffe9a2de feature: prototype of strategy controller struct 2022-04-26 18:29:21 +08:00
Andy Cheng
73c2c84cab feature: prototype of strategy controller struct 2022-04-26 18:29:21 +08:00
Andy Cheng
5799709e3e pkg: add empty strategy controller file 2022-04-26 18:29:21 +08:00
c9s
2732fb413f
bbgo: remove slack debug option 2022-04-25 18:56:19 +08:00
c9s
a57a238e09
bbgo: add more sync options 2022-04-25 17:18:42 +08:00
c9s
fae3b6a215
fix BOLL method 2022-04-25 15:31:12 +08:00
Yo-An Lin
b94b9e1b73
Merge pull request #437 from jessy1092/enhance-boll-indicator
indicator: Support difference bandwidth on boll indicator and can dynamic create BOLL
2022-04-25 13:43:02 +08:00
c9s
18da434e92 all: use thread-safe GetAccount method to get account 2022-04-23 15:43:11 +08:00
c9s
c70317af2b add autoborrow strategy 2022-04-23 15:00:04 +08:00
c9s
cf055c3f7d bbgo: improve account updating 2022-04-23 12:51:07 +08:00
c9s
9e48a850bd bbgo: call queryAccount to update account 2022-04-23 12:51:07 +08:00
c9s
ad373b95a7 add FLUSH_OTP_KEY env for flushing otp key 2022-04-17 00:35:16 +08:00
c9s
63f525970f auth: store otp key url instead of just secret 2022-04-17 00:18:48 +08:00
zenix
2a942eab0e fix: rename EVWMP to VWEMP, fix backtesting fee 2022-04-15 19:12:11 +09:00
zenix
af61952e40 fix: series not been updated 2022-04-11 17:04:56 +09:00
なるみ
4e2faacbae Mkdir if dir not exists 2022-04-07 20:21:07 +08:00
Andy Cheng
3a6f34330b
interact: refactor 2022-03-28 15:16:11 +08:00
Andy Cheng
63e8850cc3
interact: separate strategy filtering and button generation 2022-03-28 12:37:42 +08:00
Andy Cheng
ee6377ab87
interact: fix misuse of cycle() 2022-03-28 11:58:01 +08:00
Yo-An Lin
1a29bc7362
Merge pull request #492 from andycheng123/tg-control
feature: strategy controller
2022-03-26 15:41:59 +08:00
Andy Cheng
0974b1c7fd
interact: pull out the interaction related code to the caller 2022-03-23 12:05:35 +08:00
Yo-An Lin
ae4a3d81fb
Merge pull request #489 from zenixls2/feature/market_trade
feature: add market trade subscription in binance
2022-03-22 20:18:39 +08:00
Andy Cheng
5eef2a2085
interact: pull out interface filter as a function 2022-03-21 17:49:18 +08:00
Andy Cheng
f4c87e5d75
interact: refactor strategy controller related interfaces 2022-03-21 16:19:55 +08:00
Andy Cheng
fb8b79f38d
interact: rename GetStrategyStatus() to GetStatus() 2022-03-21 16:12:23 +08:00
Andy Cheng
ffd5c646e9
interact: refactor interface func name 2022-03-21 15:08:15 +08:00
Andy Cheng
962645c2c8
interact: Pull out EmergencyStop to a single instance 2022-03-21 15:05:24 +08:00
Andy Cheng
5f7710103d
type: add StrategyStatus type 2022-03-21 15:01:15 +08:00
Andy Cheng
69a02f1664
interact: add EmergencyStop() to StrategyController interface 2022-03-21 11:42:54 +08:00
Andy Cheng
b6aff9674c
strategy: add StrategyController functions to support strategy 2022-03-21 10:20:12 +08:00
Andy Cheng
5de137ced8
interact: add StrategyController interface to control strategies from telegram bot 2022-03-18 18:43:07 +08:00
zenix
efec21ca4b feature: add market trade subscription in binance 2022-03-18 18:30:39 +09:00
c9s
f85db9be61 improve asset summary layout and format 2022-03-18 17:13:37 +08:00
zenix
77a88aabe4 feature: add CancelOrders and CancelOrdersTo to executor 2022-03-16 21:38:09 +09:00
c9s
fdf64fd891 bbgo: fix emit trade profit 2022-03-15 14:29:15 +08:00
c9s
19f01bbca6 add doc comment 2022-03-14 21:21:58 +08:00
c9s
5567ef5676 fix emit trade 2022-03-14 21:21:58 +08:00
c9s
5db4e11167 rewrite trade profit handling 2022-03-14 21:21:58 +08:00
c9s
6fec30d79c call record position on trade 2022-03-14 21:21:58 +08:00
c9s
322f31a56a bbgo: improve RecordPosition method 2022-03-14 21:21:58 +08:00
c9s
5732555c2c doc: update sync configuration doc 2022-03-14 21:21:58 +08:00
c9s
08ae53ba16 bbgo: assign strategy instance id fields automatically 2022-03-14 21:21:58 +08:00
c9s
6088f7b542 bbgo: add RecordPosition method 2022-03-14 21:21:58 +08:00
c9s
9faaed6892 bbgo: initialize position service 2022-03-14 21:21:58 +08:00
c9s
b1559bcbe3 fix persistence injection 2022-03-14 21:21:43 +08:00
Yo-An Lin
bfdf4c245f
Merge pull request #460 from zenixls2/feature/backtest_multiple_exchange
feature: add multiple exchange support in backtest
2022-03-07 14:28:20 +08:00
zenix
39572c5fe0 fix: remove maker/buyer/taker/sellerCommission 2022-03-07 14:32:00 +09:00
zenix
25b5eddc03 feature: add multiple exchange support in backtest
fix: change doc, since --exchange removed from backtest

fix: test for config changes
2022-03-07 13:18:56 +09:00
c9s
917684aa27 bbgo: inject environment object 2022-03-06 18:28:40 +08:00
c9s
099d860c5a fix: fix Test_parseStructAndInject test 2022-03-06 18:28:40 +08:00
c9s
b1ba5386b3 fix bbgo.Notifiability injection 2022-03-06 16:09:15 +08:00
c9s
f6ec2e78e6 record profits 2022-03-06 15:37:41 +08:00
c9s
3a15738fec pull out default persistence selector 2022-03-06 14:06:19 +08:00
c9s
35b0d8dc0d bbgo: add profit service to environment 2022-03-05 13:40:20 +08:00
c9s
1f1c26a9e5 bbgo: inject more service objects 2022-03-05 13:37:27 +08:00
c9s
c1ac738ca0 bbgo: add doc comment for parseStructAndInject 2022-03-05 12:59:47 +08:00
c9s
bdcae5b763 bbgo: add more injection types 2022-03-05 12:49:53 +08:00
c9s
47023729ec bbgo: rewrite field injection 2022-03-05 12:39:39 +08:00
c9s
a6053e0e59 bbgo: move inject function to injection.go 2022-03-05 03:20:20 +08:00
c9s
cd6b37ac3b bbgo: skip unexported fields for injection 2022-03-05 03:19:45 +08:00
c9s
fa7bab2c3a bbgo: improve dynamic injection 2022-03-05 02:51:43 +08:00
c9s
db4d8a31bc bbgo: implement parseStructAndInject 2022-03-05 02:33:25 +08:00
c9s
9e0df77a36 move profit struct into the types package 2022-03-04 16:39:48 +08:00
zenix
8648528435 fix go fmt, fix convert.go (the legacy fixedpoint implementation) in all tests 2022-02-15 14:55:19 +09:00
zenix
5315378b9e fix takerfeerate column and makerfeerate column issue in yaml 2022-02-15 12:01:39 +09:00
zenix
fad85d0992 fix binance test, outptu for support and xgap strategies 2022-02-15 12:01:39 +09:00
zenix
05521a98b6 add skeleton strategy. fix most of the tests. fix final asset value 2022-02-15 12:01:39 +09:00
zenix
105b085786 fix bollgrid, emstop, flashcrash, funding, grid, pricealert, pricedrop, rebalance, schedule, swing, xbalance, xgap, xmaker and speedup fixedpoint 2022-02-15 12:01:39 +09:00
zenix
d9450e823e fix all the fixedpoint use other than strategy 2022-02-15 12:01:39 +09:00
zenix
b8bf2af14d fixedpoint for exchange and indicators, some fixes in types 2022-02-15 12:01:38 +09:00
zenix
e221f54397 add dnum as the fixedpoint implementation. change types float64 to fixedpoint.Value
change pnl report to use fixedpoint

fix: migrate kline to use fixedpoint
2022-02-15 12:00:39 +09:00
Andy Cheng
66b042fea7
strategy: trailing stop TP for support strategy 2022-02-06 17:47:11 +08:00
c9s
f96c2e6271 bbgo: add activated flag on trailing stop order 2022-02-01 00:41:28 +08:00
c9s
bed03dbd17 schedule: refactor and improve schedule strategy with QuantityOrAmount struct 2022-01-31 01:42:21 +08:00
c9s
11bbdb16a0 bollmaker: clean up empty files 2022-01-31 01:31:31 +08:00
c9s
0e7f88e3bf move SmartStops into the bbgo package 2022-01-31 01:27:47 +08:00
c9s
67bc5d523a bollmaker: refactor trailing stop snippet 2022-01-31 00:44:04 +08:00
c9s
0667c138ab backtest: fix duplicate trade emit issue 2022-01-30 03:05:19 +08:00
c9s
2255f3ed0a bollmaker: check dust order for stop 2022-01-29 17:44:42 +08:00
c9s
99af5d3971 bollmaker: implement TrailingStopController 2022-01-29 02:22:20 +08:00
c9s
547f4c400a cmd: call BindSync when running strategy 2022-01-27 18:19:25 +08:00
c9s
3b630c0bca bbgo: pull out writer closure 2022-01-27 18:13:15 +08:00
c9s
cb507edf44 bbgo: add BindSync method on environment 2022-01-27 18:12:15 +08:00
c9s
30a9a5849f add user data stream sync config 2022-01-27 09:34:04 +08:00
c9s
70f02a1c19 cmd: handle user config sync options in the run command 2022-01-27 08:21:19 +08:00
c9s
0d0d8b05bf bbgo/scale: test out of domain 2022-01-27 02:39:33 +08:00
c9s
1ef5a37225 bbgo/scale: check domain range 2022-01-27 02:32:26 +08:00
c9s
09213b14f3 bbgo: add negative range test for PercentageScale 2022-01-27 01:47:01 +08:00
c9s
49f671ef54 add PercentageScale and its tests 2022-01-27 01:40:54 +08:00
c9s
cfc17acd20 config: use looseFormatTime type for since field 2022-01-27 00:24:19 +08:00
c9s
a29198f733 bbgo: fix LooseFormatTime.UnmarshalYAML 2022-01-25 01:18:56 +08:00
c9s
007207e24f all: use types.LooseFormatTime to parse loose format date time string 2022-01-25 00:24:12 +08:00
c9s
5f7676f0c1 bbgo: add sync config 2022-01-25 00:06:25 +08:00
c9s
407a533659 use the standard generated comment
https://github.com/golang/go/issues/13560

Generated files are marked by a line of text that matches the regular
expression, in Go syntax:

    ^// Code generated .* DO NOT EDIT\.$ The .*

means the tool can put whatever folderol it wants in there, but the
comment must be a single line and must start with Code generated and end
with DO NOT EDIT., with a period.
2022-01-23 14:57:45 +08:00
c9s
1f18c36870 cmd: improve build command 2022-01-23 14:44:17 +08:00
c9s
7b572120a1 interact: use RemoveKeyboard from interact.KeyboardController 2022-01-23 14:13:47 +08:00
c9s
01afe9c14e interact: fix telegram session restore 2022-01-23 02:21:26 +08:00
c9s
0af5fc0530 interact: add RequireTextInput method to Reply interface 2022-01-23 02:21:26 +08:00
c9s
f5f8f15670 slack: add reply and session struct 2022-01-23 02:21:26 +08:00
c9s
ad3f038dc6 bbgo: improve otp key layout 2022-01-23 02:21:26 +08:00
c9s
c7f15efb23 interact: add Slack interaction 2022-01-23 02:21:26 +08:00
Kakashi Liu
cd85edd64d Fix: fallback to memory persistence if redis not found
resolve #438
Fix bollmaker backtest error
2022-01-22 00:55:03 +08:00
c9s
0b8e5852eb check persistence error 2022-01-19 18:29:24 +08:00
Yo-An Lin
0e0525be99
Merge pull request #418 from austin362667/refactor/futures-account
binance: add futures exchange api queries
2022-01-17 20:54:49 +08:00
c9s
5c0e3a1254 bollmaker: add shadow protection config 2022-01-16 04:40:50 +08:00
c9s
71e660571d bbgo: optimize LocalActiveOrderBook for back-testing speed 2022-01-16 01:34:28 +08:00
c9s
5d54e6fded interact: skip total == 0 balance 2022-01-16 01:06:47 +08:00
c9s
b80f481e7d interact: fix interact tests for session 2022-01-16 00:50:43 +08:00
c9s
b49fc182dc fix telegram session persistence 2022-01-16 00:39:24 +08:00
c9s
2088234b44 interact: separate telegram user sessions 2022-01-16 00:25:11 +08:00
austin362667
91d2312c5c cache: refactor moving from bbgo to pkg/cache 2022-01-15 08:28:02 +08:00
Lee
266400d925 indicator: Support difference bandwidth on boll indicator and can dynamic create BOLL 2022-01-15 05:30:06 +08:00
c9s
5f942e85ed bbgo: show position with plaintext mode instead of string format 2022-01-15 03:13:30 +08:00
c9s
1c7d4d09cf interact: add Cycle state builder 2022-01-15 03:06:36 +08:00
c9s
2a6b821908 bbgo: implement /position command 2022-01-15 02:58:55 +08:00
c9s
93722e6db3 implement position closer interaction 2022-01-15 02:52:46 +08:00
c9s
255ee40c98 bbgo: when calling order cancel we should use background context 2022-01-15 00:49:27 +08:00
c9s
77e92d544a bbgo: pull out interaction setup 2022-01-15 00:32:21 +08:00
c9s
e385d96709 bbgo: move authToken loader 2022-01-15 00:29:35 +08:00
c9s
3a13025d58 bbgo: change default notification rule -- silent order updates 2022-01-15 00:25:16 +08:00
c9s
d5f3946ada bbgo: refactor the current auth with interact 2022-01-15 00:18:07 +08:00
c9s
51ecac54e7 bbgo: fix local active book graceful cancel 2022-01-15 00:17:52 +08:00
c9s
41b94c5c7e interact: refactor telegram interaction 2022-01-14 15:03:19 +08:00
c9s
fdf7ad9648 bbgo: rename auth function for general case 2022-01-14 13:41:43 +08:00
c9s
5bef7d8a1e interact: use interaction singleton 2022-01-14 13:31:31 +08:00
c9s
dd93ee4fd3 move methods to telegramnotifier 2022-01-14 13:31:31 +08:00
c9s
43317bb647 add state and telegram example 2022-01-13 11:43:33 +08:00
c9s
ccaa8c5c86 bbgo: implement parseCommand 2022-01-13 11:43:33 +08:00
c9s
7053802041 basic interaction parser 2022-01-13 11:43:33 +08:00
c9s
6ee831e678 add trade logger 2022-01-12 11:19:41 +08:00
c9s
e5b4af53e6 all: clean up SubmitOrder fields 2022-01-11 01:36:19 +08:00
c9s
48cbb7fff6 bbgo: check order side and log error 2022-01-10 17:26:14 +08:00
c9s
d57f8fedfe bbgo: fix active book order removal 2022-01-10 12:29:19 +08:00
c9s
d94cc2df31 bbgo: add recover callbacks to trace collector 2022-01-09 15:39:59 +08:00
c9s
0cec652f38 bollmaker: skip submitOrder calls if submitOrders is empty 2022-01-09 02:35:12 +08:00
c9s
7e2acdc416 all: add lock protected GetBase method for Position 2022-01-09 00:35:45 +08:00
c9s
d1420e66be fix TestTradeCollector_ShouldNotCountDuplicatedTrade 2022-01-08 02:20:30 +08:00
c9s
e0b906a88b bbgo: fix processTrade 2022-01-07 16:53:11 +08:00
c9s
a5fb408a16 twap: refactor and call activeMakerOrders.GracefulCancel 2022-01-07 01:34:23 +08:00
c9s
e312ec953c bbgo: rename test case 2022-01-07 01:23:54 +08:00
c9s
d63cc42867 bbgo: add trade collector test 2022-01-07 01:17:07 +08:00
c9s
a49d001c29 xmaker: add trade scanner 2022-01-07 01:03:12 +08:00
c9s
69ae3259ff bbgo: mark trade as done in the trade collector for preventing duplicated trade 2022-01-07 00:28:12 +08:00
c9s
259771b0b0 all: pull out the graceful cancel process to the local active book 2022-01-07 00:10:40 +08:00
c9s
47e23fda90 bbgo: add cache expiry 2022-01-06 23:57:42 +08:00
c9s
1116fc1de1 session: print klines only when debug-kline is enabled 2021-12-31 15:13:26 +08:00
c9s
63ccc2d3d0 bbgo: remove order if ExecutedQuantity is zero 2021-12-31 01:55:22 +08:00
c9s
ba73d5a09a fix kucoin orderTime parsing and order id conversion 2021-12-30 22:02:50 +08:00