Commit Graph

181 Commits

Author SHA1 Message Date
c9s
6f16f32e16
optimize single exchange back-test 2022-05-09 17:03:01 +08:00
c9s
c9c16f1e47
show missing exchange name in the back-test config 2022-05-03 16:46:38 +08:00
c9s
946bbdbca3
backtest: rename backtest.account to backtest.accounts 2022-05-03 12:18:40 +08:00
zenix
2a942eab0e fix: rename EVWMP to VWEMP, fix backtesting fee 2022-04-15 19:12:11 +09:00
ankion
ccb7fe39fa backtest: fix order cancel fail when run order cancel on the filled event. 2022-03-16 15:01:19 +08:00
zenix
d6995e40ff fix: submit order on userDataStream == nil 2022-03-15 20:51:15 +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
0c09e6b32a use global timeInForce type 2022-02-18 13:52:13 +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
05521a98b6 add skeleton strategy. fix most of the tests. fix final asset value 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
c9s
0667c138ab backtest: fix duplicate trade emit issue 2022-01-30 03:05:19 +08:00
c9s
e595b9acb2 backtest: should panic if last price is zero 2022-01-30 02:41:00 +08:00
c9s
ec8129ab87 backtest: fix market order fee calculation 2022-01-30 02:00:30 +08:00
c9s
78855d552a backtest: fix backtest trade for market order 2022-01-30 01:37:24 +08:00
c9s
2255f3ed0a bollmaker: check dust order for stop 2022-01-29 17:44:42 +08:00
c9s
007207e24f all: use types.LooseFormatTime to parse loose format date time string 2022-01-25 00:24:12 +08:00
zenix
213ceeda82 fix: #431 for not updating lastPrice if no tade happened 2022-01-21 20:57:55 +09:00
austin362667
91d2312c5c cache: refactor moving from bbgo to pkg/cache 2022-01-15 08:28:02 +08:00
c9s
cb189d885c fix backtest for limit maker order and bollpp strategy 2022-01-08 02:18:44 +08:00
c9s
dd22776a7e cmd: refactor the exchange factory function 2021-12-25 23:27:05 +08:00
c9s
dcbce18fd8 fix format 2021-12-25 23:12:54 +08:00
c9s
442afe8eb9 backtest: pull out market data feeding to a function and call it in the main thread 2021-12-25 22:57:28 +08:00
c9s
60853bee23 backtest: pull out market data feeder 2021-12-25 22:37:38 +08:00
c9s
57bc65a729 avoid calling EmitConnect and EmitStart outside of the kline feeding goroutine
this causes 2 goroutine running in the same time hence cause the
concurrent map read / write

should fix #399, #401
2021-12-25 21:05:50 +08:00
c9s
f5bbe29ac6 cmd: fix debug flag loading and add debug log to cache function 2021-12-23 23:02:07 +08:00
c9s
562c287a4e all: move publicOnly to StandardStream 2021-12-23 17:49:18 +08:00
c9s
cfd68fdd1d all: change trade id to uint64 2021-12-23 17:49:18 +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
c9s
4665ae0e31 remove unused error return value 2021-12-10 15:03:43 +08:00
c9s
a0f46bf9b8 improve error checking, avoid using panic inside the constructor 2021-12-08 23:30:58 +08:00
c9s
2223ef088c add ftx, okex to the public exchange factory for backtest 2021-12-08 23:27:01 +08:00
c9s
d52edce40b fix markets info cache 2021-12-08 17:26:43 +08:00
c9s
634ce6180b avoid using panic when order cancel failed 2021-12-06 13:32:08 +08:00
c9s
3615477d8f backtest: allocate matching books from the exchange constructor
also adds the mutex for trades and closed orders
2021-12-06 00:38:36 +08:00
c9s
b301ea549a adjust default rate to DefaultFeeRate 0.075% 2021-12-05 12:24:51 +08:00
c9s
f692ef2c31 realign account fields 2021-12-05 12:23:27 +08:00
c9s
44d7055809 fix backtest fee rate calculation 2021-12-05 12:10:45 +08:00
c9s
4d7fe7f37d call matchingBooksMutex when assigning matching book 2021-12-05 12:06:36 +08:00
c9s
5ed337926d add mutex lock protection for backtesting
solving issue #282
2021-11-30 10:40:28 +08:00
c9s
60e4442f85 add document for the backtest engine 2021-10-05 22:06:36 +08:00
c9s
3aa36b5989 refactor and fix backtest for user data stream and market data stream 2021-05-30 15:08:11 +08:00
c9s
57a78777df move Time type to types.Time 2021-05-21 00:10:53 +08:00
c9s
e636a5008d replace Exchange field type with ExchangeName 2021-05-16 17:02:23 +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
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
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
c5eb6483a5 integrate QueryTicker for backtesting 2021-03-16 02:13:52 +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
ffa001fc29 fix quantity format 2021-02-11 00:21:56 +08:00
ycchen
288f7257eb fix testcases 2021-02-06 19:39:43 +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
9db1c78171 add public only mode to backtest 2020-12-21 15:45:40 +08:00
c9s
936650d879 rename kline trend to direction 2020-12-04 10:18:51 +08:00
c9s
04f6da3cb8 add traditional grid strategy 2020-11-10 19:06:20 +08:00
c9s
69a33b6400 fix and improve backtest 2020-11-10 14:18:04 +08:00
c9s
e7cc79f3cf replace errors.Errorf with fmt.Errorf 2020-11-09 16:34:35 +08:00
c9s
ded89e099f refactor simple price matching 2020-11-09 03:17:02 +08:00
c9s
5cc9506960 simplify executeTrade method since we should not use over locked funds 2020-11-09 03:09:12 +08:00
c9s
443f2c6891 document fee rate for BNB holders 2020-11-09 03:01:40 +08:00
c9s
377f4cae34 add account balance lock and unlock for testing maker strategies 2020-11-09 02:58:46 +08:00
c9s
f69c87b3a8 fix fee calculation and add account balance checking 2020-11-08 21:52:44 +08:00
c9s
090011da9e pull out order matching trigger from the kline event callbacks 2020-11-08 13:07:45 +08:00
c9s
e3a1184d22 fix backtest sync exchange and consider fee rate 2020-11-08 12:47:14 +08:00
c9s
6bd3573287 add exchange field in the table so that we can reuse the kline objects for backtest 2020-11-08 12:13:34 +08:00
c9s
641784e1b1 calculate pnl after the backtest 2020-11-07 20:34:34 +08:00
c9s
f3571b9832 fix tests 2020-11-07 20:18:11 +08:00
c9s
6040c69327 add sync flag for backtesting 2020-11-07 20:14:53 +08:00
c9s
f1db12eb10 add done channel for backtest exchange 2020-11-07 20:11:07 +08:00
c9s
a4a9067c6a integrate matching engine with backtest exchange 2020-11-07 19:57:36 +08:00
c9s
5be4aa53db move simple price matching to matching.go 2020-11-07 16:09:21 +08:00
c9s
3778adc8c8 implement SimplePriceMatching engine 2020-11-07 16:08:20 +08:00
c9s
b13a2deec5 emit klines and setup account balances 2020-11-07 03:18:05 +08:00
c9s
22a214328d implement backtest command, stream and add backtest config 2020-11-07 02:57:50 +08:00
c9s
c9fa565c24 remove the legacy submit order method 2020-10-26 16:44:05 +08:00
c9s
7d7828a556 move commented code 2020-10-18 12:25:08 +08:00
c9s
d2ba9cc4c3 move backtest related component to backtest package 2020-10-18 12:24:21 +08:00