Commit Graph

603 Commits

Author SHA1 Message Date
c9s
f223940b69 add db tags 2020-11-05 11:14:14 +08:00
c9s
8388f443a9 move active order book to the bbgo package 2020-11-05 11:14:14 +08:00
c9s
8e0b5d11a7 add max grid config and fix max price formatting 2020-10-31 20:38:20 +08:00
c9s
14abe3fb7e pull out active order book to the types package 2020-10-31 20:38:20 +08:00
c9s
1eb263de23 use AnyFilled to simplify the order management in the strategy 2020-10-31 20:38:20 +08:00
c9s
e264257d23 implement OrderMap and SyncOrderMap 2020-10-31 20:38:20 +08:00
c9s
2397acd45f fix type casting and assertion by passing pointer 2020-10-31 18:35:48 +08:00
c9s
0f8e9f6df7 add doc comment to Notifiability 2020-10-31 18:35:48 +08:00
c9s
eb05620f99 use Notifiability directly from environment 2020-10-31 18:35:48 +08:00
c9s
49ff9c4dd6 drop legacy trade reporter 2020-10-31 18:35:48 +08:00
c9s
c4d7476212 add submit order routing 2020-10-31 18:35:48 +08:00
c9s
ec9b5230aa refactor trade report and move trade reporter to the environment layer 2020-10-31 18:35:48 +08:00
c9s
8867ceb951 initialize Notifiability for exchange session 2020-10-31 18:35:48 +08:00
c9s
a60207db2a only re-submit the order when the order is filled on the opposite side 2020-10-31 18:33:04 +08:00
c9s
8174b64e21 handle max order update message convertion 2020-10-31 18:29:58 +08:00
c9s
458fa8aa9d add types.OrderStatusFilled 2020-10-31 18:29:58 +08:00
c9s
63df07b815 fix MAX market min price format 2020-10-31 18:29:58 +08:00
c9s
dc547aa818 fix BOLL map allocation 2020-10-31 18:29:58 +08:00
c9s
01699f7268 fix price format 2020-10-31 18:29:58 +08:00
c9s
17a2f74add finalize grid strategy 2020-10-31 18:29:58 +08:00
c9s
9c46ef17b2 handle order update 2020-10-31 18:29:58 +08:00
c9s
551fa4b7fb add grid to built-ins 2020-10-31 18:29:58 +08:00
c9s
60b78979dc fix order id parsing (seems case insensitive) 2020-10-31 18:29:58 +08:00
c9s
c3961024cf implement grid strategy update orders method 2020-10-31 18:29:58 +08:00
c9s
74a9cae38e rename trade callbacks to trade update callbacks 2020-10-31 18:29:58 +08:00
c9s
224acd0ca9 add accessors for last up band and down band values 2020-10-31 18:29:58 +08:00
c9s
e60127090b add GetBOLL access to standard indicator sets 2020-10-31 18:29:58 +08:00
c9s
d49b2be543 add bollinger indicator 2020-10-29 17:51:20 +08:00
c9s
f0681177f9 inject market into the skeleton strategy 2020-10-29 17:06:34 +08:00
c9s
4afabd92ed clean up code 2020-10-29 17:05:01 +08:00
c9s
b0cc128b79 pull out trend types 2020-10-29 17:03:36 +08:00
c9s
a7325e86f0 document swing strategy 2020-10-29 13:42:53 +08:00
c9s
5f45d18ae2 fix struct composition 2020-10-29 13:08:33 +08:00
c9s
19b600bb35 simplify strategy registration api 2020-10-29 07:54:59 +08:00
c9s
c71f013916 let SMA indicator and EWMA indicator use IntervalWindow type 2020-10-29 07:51:23 +08:00
c9s
2f8bffeaca add strict injection check fo pointer only objects 2020-10-29 07:49:06 +08:00
c9s
33257c591e refactor swing strategy with types IntervalWindow 2020-10-29 07:44:22 +08:00
c9s
6d8ec7894e refactor standard indicator set with store 2020-10-29 07:40:02 +08:00
c9s
b1cf9db879 add reflink 2020-10-28 17:50:47 +08:00
c9s
d6553a1155 move strategy subscribe out 2020-10-28 17:49:49 +08:00
c9s
f4474c6a6d add check for sma caluclation 2020-10-28 17:48:16 +08:00
c9s
67446670ac finalize swing strategy and fix trade reporter issue 2020-10-28 17:48:16 +08:00
c9s
c96845ff6a add fields to slack notifier logs 2020-10-28 17:48:16 +08:00
c9s
b22e0370b3 drop legacy OrderProcessor and remove slack debug 2020-10-28 17:48:16 +08:00
c9s
468864302e fix submit order quantity formatting 2020-10-28 17:48:16 +08:00
c9s
2680ad5072 refactor environment, market data store, injection and add swing strategy 2020-10-28 17:48:16 +08:00
c9s
7d7d2c2fc7 assign standard indicator set to the session 2020-10-28 11:15:50 +08:00
c9s
e2df24f31c support standard indicatorset 2020-10-28 09:43:19 +08:00
c9s
50693ae845 implement ewma and sma 2020-10-28 09:13:57 +08:00
c9s
388346b284 move injectStrategyField to a single file 2020-10-27 20:42:48 +08:00
c9s
008e5c83f9 fix notification config check 2020-10-27 20:41:08 +08:00
c9s
e1c2f7cc3d improve notifier signatures and fix slack Notify method 2020-10-27 20:13:10 +08:00
c9s
7905ba09d4 pull out fillStrategyNotifiability 2020-10-27 19:37:11 +08:00
c9s
ccc381143d support pointer type filling 2020-10-27 19:33:11 +08:00
Yo-An Lin
1e5327a5e4 Update strategy.go 2020-10-27 15:51:36 +08:00
c9s
b3eaf832af Add pricealert strategy for demonstrating notification 2020-10-27 13:54:39 +08:00
c9s
ab43de3efd clean up comment for base order executor 2020-10-27 10:00:41 +08:00
c9s
ef598c3a0f assign base order executor descendingly 2020-10-27 09:58:21 +08:00
c9s
8453e95300 configure channel routers 2020-10-27 09:38:29 +08:00
c9s
42f947506c add route methods on Notifiability 2020-10-27 09:24:59 +08:00
c9s
ea05d998f2 load notification conf 2020-10-27 08:57:00 +08:00
c9s
c315b79bd7 add notification config 2020-10-27 08:48:47 +08:00
c9s
284a0676f7 remove unused confg package 2020-10-27 08:19:16 +08:00
c9s
955479486a add symbol channel router and object channel router for notification 2020-10-27 08:19:16 +08:00
c9s
1d8e0bff5a drop legacy NewDefaultEnvironment method 2020-10-27 08:19:16 +08:00
c9s
0fd9e8b95a reset price field when market order is used 2020-10-26 22:08:16 +08:00
c9s
085d02bee4 clean up strategy code since we can loaded from the config 2020-10-26 22:04:48 +08:00
c9s
38c87bfecc drop config dir 2020-10-26 21:46:38 +08:00
c9s
a1eeb55778 refactor and clean up bbgo config 2020-10-26 21:45:02 +08:00
c9s
c324a791f6 refactor and configure risk control order executor 2020-10-26 21:36:47 +08:00
c9s
59aa5c5ee2 implement RiskControlOrderExecutor 2020-10-26 18:28:34 +08:00
c9s
4e7c1a327b pull out order formatter 2020-10-26 18:17:18 +08:00
c9s
a4b6a5f923 load order executor config 2020-10-26 17:57:28 +08:00
c9s
502e5bdc04 load exchange sessions dynamically 2020-10-26 17:00:17 +08:00
c9s
8274f6e97c reformat OrderProcessor code 2020-10-26 16:45:09 +08:00
c9s
c9fa565c24 remove the legacy submit order method 2020-10-26 16:44:05 +08:00
c9s
359b3c56b4 move files 2020-10-26 16:15:30 +08:00
c9s
19f259111d improve config loading by adding unmarshal yaml method 2020-10-26 15:33:25 +08:00
c9s
cd666fdf9e pull out db parameter from the constructor 2020-10-26 15:06:39 +08:00
c9s
3aa40f3aab disable viper config for now 2020-10-26 13:56:48 +08:00
c9s
332ca7ffe8 make trade sync optional 2020-10-26 13:48:59 +08:00
c9s
931c646fde configure notifier and make slack notification optional 2020-10-26 13:40:43 +08:00
c9s
ac0a26b005 add build command 2020-10-26 13:27:07 +08:00
c9s
9017d2a9a7 add go os and arch name to the binary name 2020-10-26 11:41:21 +08:00
c9s
aa6ccbf905 refactor xpuremaker strategy 2020-10-26 10:08:58 +08:00
c9s
fbba9b12ce xpuremaker: final clean up 2020-10-26 10:01:18 +08:00
c9s
145264aae4 cancel orders and re-submit maker orders 2020-10-26 00:26:17 +08:00
c9s
336fb4d25b max: fix order cancel request payload 2020-10-25 22:41:54 +08:00
c9s
de11ef10f5 return created order objects from SubmitOrders method 2020-10-25 19:22:22 +08:00
c9s
fa30f6b52a Support binance order update execution type convertion 2020-10-25 19:22:22 +08:00
c9s
391767953a Fix binance trade transaction time convertion 2020-10-25 19:22:22 +08:00
c9s
308427416a Add more exchange order features
- use uuid for client order id
- add stop limit and stop market order types
- add order convert functions
- improve submit orders
2020-10-25 19:22:22 +08:00
c9s
1e12de28da Add xpuremaker skeleton 2020-10-25 18:32:46 +08:00
c9s
3721714f00 Support json unmarshaller for fixedpoint 2020-10-25 18:32:45 +08:00
c9s
944b673626 Add skeleton strategy 2020-10-25 18:32:43 +08:00
Yo-An Lin
9f416579ec Merge pull request #25 from c9s/feature/go-compile-os-arch
feature: support go build with custom os and arch
2020-10-24 17:45:03 +08:00
c9s
916b3b0eca early return if len of trades == 0 2020-10-24 16:32:54 +08:00
c9s
81653c6451 improve compile function for goos and goarch 2020-10-24 16:29:58 +08:00
c9s
2535a5803e alias logrus into log 2020-10-24 15:43:55 +08:00
c9s
9ce9ecc910 compile local strategies into the wrapper binary 2020-10-24 15:38:13 +08:00
c9s
cd28fb8771 unmarshal imports into config 2020-10-23 14:49:54 +08:00
c9s
e1e8a16f97 rename Run to Execute to avoid confusion 2020-10-23 14:38:24 +08:00
c9s
bcc97c1906 cmd: rename slack-trading-channel to slack-channel 2020-10-23 14:29:02 +08:00
c9s
048374566c move commands into pkg/cmd 2020-10-23 14:28:07 +08:00
c9s
0ec57cf404 add import section 2020-10-23 14:14:07 +08:00
c9s
407db84689 check runtime registered strategies 2020-10-23 14:13:16 +08:00
c9s
6e033461bb use the time of the first trade as the report start time 2020-10-23 14:09:05 +08:00
c9s
c9f5d51556 confgi: fix []interface parsing issue 2020-10-23 14:01:45 +08:00
c9s
9127913370 improve parsing for one or more string slice 2020-10-23 13:50:17 +08:00
c9s
6b0f2b80d7 add multiple spec support 2020-10-23 00:21:03 +08:00
c9s
9c751f377a import buyandhold strategy 2020-10-22 16:04:37 +08:00
c9s
aea6a7c03d integrate AverageCostPnLReporter 2020-10-22 15:57:50 +08:00
c9s
897d882c35 update Notifiability interface 2020-10-22 14:45:15 +08:00
c9s
ea3e9e7d05 add per-session-based trade reporter 2020-10-22 10:54:03 +08:00
c9s
678e4ef4ab add trade reporter 2020-10-22 10:47:54 +08:00
c9s
a714af739a implement TradeReporter 2020-10-21 19:52:55 +08:00
c9s
b1a9a66dba assign account and stream when allocating session object 2020-10-21 17:42:37 +08:00
c9s
1f71fa623c add channel argument to the notify method 2020-10-21 17:10:47 +08:00
c9s
58265d14f9 move cmdutil package 2020-10-21 15:58:58 +08:00
c9s
81f2cb4ac4 support loading cross exchange strategies 2020-10-21 15:49:43 +08:00
c9s
606c59ad4d connecting strategies with session name 2020-10-20 15:54:32 +08:00
c9s
324a493aad improve config loader 2020-10-20 15:42:57 +08:00
c9s
4ee10de40f add LoadedCrossExchangeStrategies loader api 2020-10-20 14:21:46 +08:00
c9s
f4066b18b3 wrap error to make the message clear 2020-10-20 14:15:12 +08:00
c9s
8cc5db7506 add baseQuantity 2020-10-20 14:14:21 +08:00
c9s
2fbf19455e implement strategy yaml loader 2020-10-20 13:52:25 +08:00
c9s
a08aebaa17 bbgo: add SetTradeScanTime method 2020-10-20 13:11:04 +08:00
c9s
3b3df77ec3 clean up the legacy context struct 2020-10-20 12:24:30 +08:00
c9s
752fdf5c80 document WithCache function 2020-10-20 12:22:18 +08:00
c9s
2bbee6671a make the first arg of WithCache as a key var 2020-10-20 12:18:29 +08:00
c9s
40c697275d query market config with cache 2020-10-20 12:11:44 +08:00
c9s
180bfff558 loadedSymbols is not used in the init method 2020-10-20 11:49:18 +08:00
c9s
f6c1ed67e6 add CacheDir function 2020-10-20 11:48:44 +08:00
c9s
f62f3b8a02 define HomeDir and SourceDir helper functions 2020-10-20 11:46:44 +08:00
c9s
fc687f3174 max: implement kline event parser for websocket 2020-10-19 22:46:34 +08:00
c9s
d68564de28 improve logging 2020-10-19 22:26:43 +08:00
c9s
366036a35b max: parse and convert trade update 2020-10-19 22:23:49 +08:00
c9s
822e4c2703 receive trade in value instead of pointer 2020-10-19 22:06:43 +08:00
c9s
292dd2492a add comment for loadedSymbols 2020-10-19 22:02:05 +08:00
c9s
a4b872fc8b clean up init and connect phase 2020-10-19 22:00:44 +08:00
c9s
6d6e79eab3 fix session initialization issue 2020-10-19 21:58:50 +08:00
c9s
b0b1d2bd49 max: fix currency conversion 2020-10-19 21:33:21 +08:00
c9s
c4490a119c send order book to the update handler 2020-10-19 11:44:15 +08:00
c9s
50c6a675dd add doc comment to StreamOrderBook 2020-10-19 10:44:11 +08:00
c9s
68279757fa add kline accessor KLinesOfInterval 2020-10-18 20:44:12 +08:00
c9s
c1590786e8 integrate orderbook updates to market data store 2020-10-18 20:44:12 +08:00
c9s
75115774f6 rename kline store to market data store back 2020-10-18 20:44:12 +08:00
c9s
b7a450327c rename files 2020-10-18 12:33:51 +08:00
c9s
f9940a9c2f rename market data store to kline store 2020-10-18 12:32:43 +08:00
c9s
f826bb014a make markets field private 2020-10-18 12:30:13 +08:00
c9s
dab264a4ad add more accessors to exchange session, so that we can make it as an interface 2020-10-18 12:29:38 +08:00
c9s
168cb355fc add accessor to MarketDataStore 2020-10-18 12:27:11 +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
c9s
028aef9402 move marketdata store to store package 2020-10-18 12:23:00 +08:00
c9s
90515855eb move MovingAverageIndicator 2020-10-18 11:37:01 +08:00
c9s
a1c027471e remove more empty files 2020-10-18 11:35:40 +08:00
c9s
d011bf275e move stock_test file and testdata 2020-10-18 11:34:36 +08:00
c9s
cbeb809b22 delete empty pnl file 2020-10-18 11:33:58 +08:00
c9s
c878de10bf delete empty market.go file 2020-10-18 11:33:43 +08:00
c9s
0d9c0bd51b move cost distribution to the accounting package 2020-10-18 11:33:13 +08:00
c9s
985e02c57a delete empty file 2020-10-18 11:31:44 +08:00
c9s
73e17730d7 move account type into types package 2020-10-18 11:30:37 +08:00
MengZn
3bbf15bb7e fix misspell 2020-10-18 00:36:52 +08:00
c9s
fe1a25d735 max: add resolution to the subscription 2020-10-18 00:09:37 +08:00
c9s
c224eb7af7 add kline to the market data store 2020-10-18 00:06:08 +08:00
c9s
530da665d3 fix max newAuthenticatedRequest for nil data 2020-10-18 00:05:54 +08:00
c9s
9ebccc72ba add exchange session constructor 2020-10-17 23:51:44 +08:00
c9s
2d88f8e5f6 remove unused empty method convertDepthResponseToSnapshot 2020-10-17 23:49:14 +08:00
c9s
615da2e1d8 add logger with fields 2020-10-17 10:39:03 +08:00
c9s
25b4b22077 let strategy attach could be chained 2020-10-16 13:52:18 +08:00
c9s
4335cca0de make it possible to attach multiple strategies in one call 2020-10-16 10:26:45 +08:00
c9s
27b582e948 move report struct 2020-10-16 10:21:37 +08:00
c9s
63ea81b648 simplify the calculator api 2020-10-16 10:19:53 +08:00
c9s
a6b99f6828 rename ProfitAndLossCalculator to AverageCostCalculator 2020-10-16 10:16:42 +08:00
c9s
ee86a71ebb split files 2020-10-16 10:14:36 +08:00
c9s
98192ae91f move Cmd to the strategy package 2020-10-16 10:09:42 +08:00
LeoZhan
c501fda4e2 refactor: remove redundant filename extension 2020-10-16 00:49:46 +08:00
c9s
7482fa52d6 add error check and logger 2020-10-15 23:38:00 +08:00
c9s
300609e3db fix subscription initialization 2020-10-15 22:36:22 +08:00
c9s
113cc8ee48 query markets and assign into the exchange session 2020-10-15 21:04:02 +08:00
c9s
c167b2f303 add query markets to the exchagne interface 2020-10-14 11:02:50 +08:00
c9s
5112b83041 max: fix internal currency usage 2020-10-14 11:02:10 +08:00
c9s
c58375f57e max: extend max exchange market information 2020-10-14 10:53:18 +08:00
c9s
6d00a7ba07 fix import 2020-10-14 10:39:50 +08:00
c9s
88461396f1 rearrange market config fields 2020-10-14 10:39:14 +08:00
c9s
2b41f76082 add maxPrice, minPrice and tickSize config 2020-10-14 10:34:33 +08:00
c9s
64c2170cd5 implement QueryMarkets on binance 2020-10-14 10:16:59 +08:00
c9s
f454136449 add exechange order executor and pull out Notifiability 2020-10-14 10:06:15 +08:00
c9s
a91f851ac7 pass types.SubmitOrder by value 2020-10-13 18:08:02 +08:00
c9s
ec23266cc2 implement buyandhold strategy to test the api design 2020-10-13 16:17:07 +08:00
c9s
d1b618850d add context parameter to the strategy method 2020-10-13 14:50:59 +08:00
c9s
fe3ae14fc8 clean up 2020-10-13 11:23:22 +08:00
c9s
26f97b43e8 drop legacy backtest trader 2020-10-12 22:51:13 +08:00
c9s
4c20c9f4ff replace LoadAccount with literal constructor 2020-10-12 22:49:27 +08:00
c9s
6398f049d0 bind market data store and query avg price before we start 2020-10-12 22:46:06 +08:00
c9s
bace7ac3a3 add environment connect integration tests 2020-10-12 17:33:02 +08:00
c9s
4ce716d6ad binance: make asset parameter optional 2020-10-12 17:15:33 +08:00
c9s
92a5eac412 make currency parameter optional 2020-10-12 17:15:13 +08:00
c9s
64c9960882 use types.Exchange 2020-10-12 07:38:38 +08:00
c9s
ea7b501c26 add transfer history command for calculating baseline and show transfer records 2020-10-11 20:08:54 +08:00
c9s
2d246c3f71 move deposit type to global type and add max deposit history support 2020-10-11 17:35:59 +08:00
c9s
3d5507a053 move files into pkg 2020-10-11 16:46:15 +08:00