Commit Graph

794 Commits

Author SHA1 Message Date
c9s
ff5233ba3e support: use Notfiy 2021-02-20 10:51:01 +08:00
c9s
dd13b9a8bf remove start time query condition for trade sync since starting from trade id = 1 works 2021-02-19 14:18:50 +08:00
c9s
44fa74a4c9 refactor session sync 2021-02-19 10:42:24 +08:00
c9s
390c9b1a4b move Sync method into the sync service 2021-02-19 10:26:13 +08:00
c9s
eaa8c647b5 refactor session sync 2021-02-18 22:40:46 +08:00
c9s
90069a8589 improve sync command to find possible trading symbols automatically 2021-02-18 22:07:54 +08:00
c9s
65ff2894c5 binance: calculate quote quantity manually if it's not defined 2021-02-18 18:24:00 +08:00
c9s
3a89b0a714 improve trade sync 2021-02-18 18:20:18 +08:00
c9s
654ad62f36 remove type assert 2021-02-18 17:42:14 +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
c3dbb1b204 avoid using last trade id for syncing data 2021-02-18 16:40:47 +08:00
c9s
29bbd03836 add binance single ticker query method and fix quantity formating 2021-02-18 16:17:40 +08:00
c9s
b9564690b5 fix go migration loader 2021-02-17 19:06:55 +08:00
c9s
b2bcd3528c use sqlx for testing connection 2021-02-17 17:35:54 +08:00
c9s
88f7f0f61c compile and update migration package 2021-02-17 17:35:11 +08:00
c9s
ea27a291db compile and update migration package 2021-02-17 17:28:05 +08:00
c9s
a1cb3859c3 fix db driver setup 2021-02-17 14:57:29 +08:00
c9s
e372a53835 refactor transfer history command 2021-02-17 14:43:50 +08:00
c9s
49f4039a23 add timestamp parameter 2021-02-16 17:11:15 +08:00
c9s
9a7437de53 set default limit to 1000 2021-02-16 17:10:58 +08:00
c9s
5f759780c3 remove unused since flag 2021-02-16 17:10:48 +08:00
c9s
3867fdde91 add stringer interface to Position 2021-02-16 16:40:11 +08:00
c9s
bc3754d989 check if limit is set 2021-02-16 16:39:56 +08:00
c9s
02512805f8 set default query trade limit to 1000 for max 2021-02-16 16:32:48 +08:00
c9s
e3d3eacb78 fix trade service injection 2021-02-16 16:30:01 +08:00
c9s
8ae4cab550 inject TradeService field if we found it 2021-02-16 16:14:49 +08:00
c9s
c75eb6b5ba pull out Persistence injection to the common injection 2021-02-16 16:13:52 +08:00
c9s
5c1630f000 refactor strategy executor 2021-02-16 16:12:00 +08:00
c9s
bf0ba89aee convert StrategyID field to NullString 2021-02-16 16:00:14 +08:00
c9s
fc4419b49b refactor injection 2021-02-16 15:58:21 +08:00
c9s
1c2646b0af add Test_injectField 2021-02-16 15:49:57 +08:00
c9s
67a3c49081 add more trade service tests 2021-02-16 15:34:01 +08:00
c9s
ebe065332c allocate sqlx db from rockhopper db 2021-02-15 21:07:55 +08:00
c9s
c219dc7be0 add test code for testing migration scripts 2021-02-15 21:04:44 +08:00
c9s
3d47b3f34d update trade fields for pnl and strategy id 2021-02-15 20:55:14 +08:00
c9s
786f37e675 add MarkStrategyID for marking trade with the source strategy 2021-02-15 20:53:19 +08:00
c9s
f3d65b1281 add UpdatePnL method for updating trade pnl field 2021-02-15 20:51:34 +08:00
c9s
8224447985 fix build tags 2021-02-15 16:21:47 +08:00
c9s
0c9ca851e5 improve support strategy 2021-02-15 01:26:46 +08:00
c9s
bea750ca97 make margin order side effect json unmarshallable 2021-02-15 01:26:23 +08:00
c9s
f8378957ee add more checks for bollgrid
related to #93
2021-02-13 16:03:31 +08:00
Yo-An Lin
de195b3c17 Merge pull request #130 from Larry850806/fix/bollgrid 2021-02-11 15:38:50 +08:00
Larry850806
ca31179b40 Fix balance calculation 2021-02-11 14:48:13 +08:00
c9s
f7ef91b55c binance: set the default ping handler 2021-02-11 08:13:50 +08:00
c9s
4a0bd45301 remove order test code 2021-02-11 00:30:37 +08:00
c9s
ffa001fc29 fix quantity format 2021-02-11 00:21:56 +08:00
c9s
88411a134b add supportAndTargets strategy 2021-02-11 00:21:06 +08:00
c9s
4b66deec3d subscribe RepostInterval as well
might be related to issue #93
2021-02-10 22:45:23 +08:00
c9s
061312771c fix float formatting 2021-02-10 22:41:42 +08:00
c9s
57435419b4 add marketData label 2021-02-10 22:40:36 +08:00
Larry850806
9f6d9028fa Use fixedpoint type to calculate the balance 2021-02-10 16:01:11 +08:00
Larry850806
6d399647cf Remove unused functions 2021-02-10 11:37:37 +08:00
Larry850806
11a176145e Refactor placeGridOrders into three functions 2021-02-10 11:37:33 +08:00
Larry850806
d22a8e9c63 Improve bollgrid strategy's balance check and quote calculation 2021-02-10 10:11:32 +08:00
YC
776cd95955 Merge pull request #128 from c9s/ftx/balance 2021-02-09 19:49:38 +08:00
Yo-An Lin
bb394c8d38 Merge pull request #124 from ychi/feat/calculate-asset-with-ticker
feat/calculate asset with ticker
2021-02-09 17:49:22 +08:00
Yo-An Lin
5b06c47b2a Merge pull request #125 from c9s/fix/grid 2021-02-09 12:02:04 +08:00
ycchen
2b285c0202 fix: remove unused 2021-02-08 22:43:20 +01:00
ycchen
6655e16889 minor tweaks 2021-02-08 22:41:44 +01:00
ycchen
61c98432f2 feat: tickers for asset calculation 2021-02-08 22:41:44 +01:00
ycdesu
ed86e923df ftx: add exchange name 2021-02-08 22:33:12 +08:00
ycdesu
0eb0bdefa2 ftx: use uppercase in toGlobalCurrency 2021-02-08 22:29:50 +08:00
ycdesu
46b0315871 ftx: implement ftx balances querying 2021-02-08 19:07:18 +08:00
ycdesu
eb00720043 ftx: define empty ftx.toGlobalCurrency 2021-02-08 19:07:18 +08:00
ycdesu
7c48670c39 ftx: define rest client 2021-02-08 19:07:18 +08:00
ycdesu
8663704d6e util: create IsJSON/IsHTML type helper 2021-02-08 19:07:18 +08:00
ycdesu
565086cc2a util: extract IsError method 2021-02-08 19:07:18 +08:00
ycdesu
54ef8d3ca6 ftx: define empty exchange 2021-02-08 19:04:18 +08:00
c9s
72044a63fd remove query trades default limit 200 2021-02-08 13:40:47 +08:00
c9s
ffb6a29d0d fix startPrice value conversion 2021-02-08 13:21:22 +08:00
Yo-An Lin
f8ae8ec5b0 Merge pull request #108 from ychi/feat/exchange-ticker-api 2021-02-08 07:37:50 +08:00
ycchen
7a67083fbe Address review feedbacks 2021-02-07 22:58:30 +01:00
Jui-Nan Lin
001f0e8c2f fix(max): use global trade side here, not string 2021-02-07 14:58:44 +08:00
c9s
173074f5e4 improve grid strategy's balance check and quote calculation 2021-02-07 11:37:24 +08:00
c9s
367e9fcae1 fix price range check 2021-02-07 10:58:31 +08:00
ycchen
288f7257eb fix testcases 2021-02-06 19:39:43 +01:00
ycchen
5fed7b81de QueryTicker 2021-02-06 18:35:23 +01:00
ycchen
fa20df487e feat: ticker api for types.Exchange 2021-02-06 14:05:26 +01:00
Yo-An Lin
a738bffc07 Merge pull request #112 from jnlin/fix/pnl-amount 2021-02-06 18:26:04 +08:00
Yo-An Lin
b81eb33cad Merge pull request #117 from c9s/wizard/sqlite3
add sqlite3 driver option to the wizard user interface
2021-02-06 17:41:45 +08:00
Jui-Nan Lin
b38b65ce83 fix(pnl): do not calculate the "self" trade 2021-02-06 17:34:13 +08:00
Jui-Nan Lin
30f085fa91 fix(max): IsBuyer should check side "buy" and "bid" 2021-02-06 17:30:18 +08:00
Jui-Nan Lin
7e1825d991 Merge branch 'main' into fix/pnl-amount 2021-02-06 17:22:43 +08:00
c9s
d0c967af55 use fake asset data for the asset query 2021-02-06 16:38:00 +08:00
c9s
8e0778a095 fix trading volume query for sqlite3 2021-02-06 16:05:21 +08:00
Yo-An Lin
597dd21865 Merge pull request #116 from c9s/feature/sqlite3
convert time struct for sqlite driver
2021-02-06 15:05:49 +08:00
c9s
62145d02f3 move dotenv loading to the root command 2021-02-06 15:03:07 +08:00
c9s
855378e098 add driver field to the setup db route 2021-02-06 14:31:46 +08:00
c9s
26f9e5488d apply datatype.Time to order time fields 2021-02-06 14:30:00 +08:00
c9s
20e6e4c299 add MarshalJSON and UnmarshalJSON to datatype.Time 2021-02-06 14:25:38 +08:00
c9s
3abdb3dd7b convert time struct for sqlite driver 2021-02-06 12:32:21 +08:00
Yo-An Lin
5a5e64cc8d Merge pull request #111 from c9s/feature/sqlite3
add sqlite3 migration support
2021-02-06 11:52:03 +08:00
c9s
32117af4b0 service: remove the ignore keyword to make the sql compatible with sqlite3 2021-02-06 11:44:49 +08:00
c9s
0b657d59f9 make inBaseAsset as private method 2021-02-06 11:34:53 +08:00
c9s
dd9dbee903 refactor database configuration with env vars 2021-02-06 11:33:49 +08:00
c9s
99b56003eb clean up legacy db connection handling with the new database service 2021-02-06 11:22:04 +08:00
c9s
276b6c1e48 drop the legacy upgradeDB 2021-02-06 11:22:04 +08:00
c9s
c7440a3ea4 compile and update migration package 2021-02-06 11:22:04 +08:00
c9s
de51eb29e4 refactor db stuff with database service 2021-02-06 11:22:04 +08:00
ycdesu
06eacf70a2 util: test Response struct 2021-02-05 22:38:45 +08:00
ycdesu
f44d6a323a http: move response helper to util 2021-02-05 22:31:40 +08:00
Yo-An Lin
8c72e2290e Merge pull request #110 from jnlin/options_orderlimit 2021-02-05 19:30:41 +08:00
Jui-Nan Lin
c9f3b6fc1a fix(pnl): checking the side of trade, not taker or maker 2021-02-05 14:52:38 +08:00
Jui-Nan Lin
b6da7ee2f2 fix(pnl): should be trades 2021-02-05 14:49:42 +08:00
c9s
ea0c20cfe7 rename enableApiServer to enableWebServer 2021-02-05 13:04:52 +08:00
c9s
0803d6bae0 add BeforeRestart hook 2021-02-05 13:01:07 +08:00
Jui-Nan Lin
8eb8fb105d test: fix query trading test 2021-02-05 12:42:59 +08:00
Jui-Nan Lin
893b513605 feat: add limit option for pnl command 2021-02-05 10:12:10 +08:00
c9s
10f8a7864f fix side bar layout 2021-02-05 09:09:59 +08:00
c9s
bd895149ad if dotenv file does not exist, do not load it 2021-02-04 20:34:31 +08:00
c9s
621321f5db add basic desktop app 2021-02-04 20:34:31 +08:00
c9s
0cb2a3c452 split files to make routes smaller 2021-02-04 16:59:00 +08:00
c9s
5f84c847c1 move setupRestart 2021-02-04 16:54:24 +08:00
c9s
e1b4ff3450 move setup handlers to setup.go 2021-02-04 16:51:53 +08:00
c9s
c12161ff1c pull out listSessionSymbols 2021-02-04 16:49:47 +08:00
c9s
3dfc75591a Add RunWithListener method to server 2021-02-04 16:47:53 +08:00
c9s
c1b2114dd2 refactor server routes 2021-02-04 16:44:14 +08:00
c9s
2791da3ec4 fix empty session issue 2021-02-04 15:19:40 +08:00
c9s
d8d1249293 fix env var prefix by using os.Getenv directly 2021-02-04 15:14:54 +08:00
c9s
e6b0a0c595 implement server shutdown goroutine 2021-02-04 14:44:48 +08:00
c9s
e257f6e8f6 pull out pingUntil function 2021-02-04 14:29:15 +08:00
c9s
f2686d02b0 refactor ping handler 2021-02-04 14:00:41 +08:00
c9s
42e5c88a2f refactor more setup route handlers 2021-02-04 13:59:26 +08:00
c9s
f74ebd48e2 refactor setup routes 2021-02-04 13:56:36 +08:00
c9s
7c6fce076f use ping try the api server 2021-02-04 13:48:21 +08:00
c9s
6db1924f87 add setup struct for setup mode options 2021-02-04 13:29:43 +08:00
c9s
7b7bcf56c9 add PUT and DELETE methods 2021-02-04 13:23:05 +08:00
c9s
f21b7f06d7 update static files and fix page routes 2021-02-03 18:54:35 +08:00
c9s
b3aa7e7511 add darwin os check 2021-02-03 18:54:34 +08:00
YC
d821d2ef95 Merge pull request #103 from ycdesu/minor/order/tests 2021-02-03 18:52:11 +08:00
YC
cc146faae2 Merge pull request #101 from ycdesu/minor/trade/tests
minor: extract SQL generator function of trades table
2021-02-03 18:32:25 +08:00
ycdesu
72b1877e4a order: extract query order sql generator 2021-02-03 18:31:32 +08:00
c9s
c73e5f00f3 refactor server routes 2021-02-03 18:09:33 +08:00
c9s
bf8508d4fb update description 2021-02-03 17:41:48 +08:00
c9s
4e31c7f68a change default config path to just bbgo.yaml 2021-02-03 17:39:53 +08:00
c9s
9096b6425e move instructions sequence 2021-02-03 17:29:51 +08:00
c9s
c35cef5b09 implement config saving api 2021-02-03 17:27:18 +08:00
ycdesu
220da92f48 trade: extract sql generator function and test it 2021-02-03 16:51:02 +08:00
ycdesu
1522c3d7a6 trade: create a separate sql gen function 2021-02-03 15:44:02 +08:00
c9s
f7a4f7d415 add strategies endpoint and strategy review page 2021-02-03 15:00:01 +08:00
c9s
705edc38c0 implement config yaml dummper 2021-02-03 09:58:31 +08:00
c9s
098a966813 add test case for config.Map method 2021-02-03 09:34:53 +08:00
c9s
1a2c3556a8 add ID method to the TestStrategy 2021-02-03 09:09:19 +08:00
c9s
7904c6f4d0 add ID() to Strategy interface 2021-02-03 09:08:05 +08:00
c9s
8aa96c4546 integrate strateg adding api 2021-02-03 02:26:41 +08:00
c9s
578451bb51 add setup flag to run server 2021-02-02 18:17:58 +08:00
c9s
d458519ba5 add setup flag 2021-02-02 18:17:39 +08:00
c9s
17d5e301dc refine setup steps 2021-02-02 17:26:35 +08:00
c9s
73762d9888 support exchange session test from the setup wizard 2021-02-02 11:44:07 +08:00
c9s
06f648448b pull out wrapper runner 2021-02-01 20:44:15 +08:00
c9s
eebb568b0c add dotenv string flag for changing dotenv filename 2021-02-01 20:44:15 +08:00
c9s
0a29ee99b8 call godotenv.Load to load env vars 2021-02-01 20:44:15 +08:00
c9s
a60aeb4771 pull out .Subscribe from trader.Run 2021-02-01 20:44:15 +08:00
c9s
ddcc8ae4ee move ExchangeOrderExecutor into exchange session 2021-02-01 20:44:15 +08:00
c9s
de8e717a41 refactor session initialization function 2021-02-01 20:44:15 +08:00
c9s
6912f77c72 fix lock issue 2021-02-01 18:55:47 +08:00
c9s
a926ee1e37 rename --enable-api-server to --enable-web-server 2021-01-29 19:31:52 +08:00
c9s
fbbe304dfb add trades query api 2021-01-29 18:48:00 +08:00
c9s
cc8133a90e print order query sql 2021-01-29 18:34:03 +08:00
c9s
72037d6c14 update migration package 2021-01-29 18:28:23 +08:00
c9s
b8d7ae7687 add AggOrder for market orders 2021-01-29 17:52:13 +08:00
c9s
32645f228b add order query api 2021-01-29 13:15:44 +08:00
c9s
be750b94df fix layout and margin 2021-01-29 12:55:11 +08:00
c9s
8031c6066e mount static files to routes 2021-01-29 11:19:37 +08:00
c9s
78890834b5 support symbol segment 2021-01-28 18:51:35 +08:00
c9s
9ee49ea3f1 Add TradingVolumeBar 2021-01-26 18:10:08 +08:00
c9s
95129e94d7 add lastPrcieUpdatedAt timestamp for checking last price cache 2021-01-26 17:23:40 +08:00
c9s
df17c4b1b6 add trading volume query api 2021-01-26 17:21:18 +08:00
c9s
9717fddfbd add total asset pie chart 2021-01-25 16:56:02 +08:00
c9s
e47357d1ed add assets api and price loading 2021-01-25 15:32:17 +08:00
c9s
09b3046feb lower case fields are not exported to json 2021-01-25 14:32:46 +08:00
c9s
b952e6fd54 rename Reset to private reset 2021-01-25 14:26:22 +08:00
c9s
4c0a586aa2 adjust depth update to 5 minutes 2021-01-25 14:24:59 +08:00
c9s
ca71c81284 improve slice copying 2021-01-25 14:20:56 +08:00
c9s
b99c01a03f fix stream book usage 2021-01-25 14:13:39 +08:00
c9s
1aefbbfddc improve orderbook validation error 2021-01-25 13:53:11 +08:00
c9s
7310700540 add account and account balances 2021-01-24 20:18:04 +08:00
c9s
eab915abc7 rename loaded-symbols to just symbols 2021-01-24 20:14:43 +08:00
c9s
3a52a4bff8 add and set AddOrderUpdate flag for session order store 2021-01-24 20:13:05 +08:00
c9s
e2de3040bd adjust ping ticker to 10seconds 2021-01-24 19:08:33 +08:00
c9s
42b66d6898 add OrderStore accessor on ExchangeSession 2021-01-24 19:08:12 +08:00
c9s
9040f6ff0d add --enable-api-server flag 2021-01-24 19:07:56 +08:00
c9s
447057086c add Orders method on OrderStore 2021-01-24 19:07:32 +08:00
c9s
eccc2c6e0f implement session config api and server 2021-01-24 18:42:36 +08:00
c9s
7632638982 log depth api error 2021-01-24 16:54:13 +08:00
c9s
51e5deee47 add frontend files 2021-01-24 14:14:25 +08:00
c9s
1892d03326 make session trades map thread safe 2021-01-24 14:14:25 +08:00
c9s
1c80d30ce2 add TradeSlice with sync 2021-01-24 14:14:25 +08:00
c9s
84b6982033 add order store to exchange session 2021-01-24 14:14:25 +08:00
c9s
568250f4bb define api routes 2021-01-24 14:14:25 +08:00
c9s
cabc082713 fix f.loadDepthSnapshot timing 2021-01-24 14:12:44 +08:00
c9s
50fc1fd3ac call Reset instead of replacing the whole map
the reason is that we have the update worker, which is already started.
2021-01-24 14:09:07 +08:00
c9s
2b441ad3bc binance: improve depth event filtering and reloading 2021-01-24 10:02:38 +08:00
c9s
1f1e1383f3 fix advancedOrderCancelApi interface 2021-01-23 17:20:26 +08:00
c9s
858a8d84bb groupID is an int64 field 2021-01-23 17:17:46 +08:00
c9s
4b039847b7 support group ID 2021-01-23 17:15:32 +08:00
c9s
b5f2c325a4 add group id field 2021-01-23 17:07:05 +08:00
c9s
e08d62395e adjust snapshot ticker to 10 minutes 2021-01-23 17:03:53 +08:00
c9s
6a6dacd595 fix binance depth snapshot updating 2021-01-23 16:59:51 +08:00
c9s
d0fc161ae7 fix define build config checking 2021-01-23 01:06:56 +08:00