update doc

This commit is contained in:
c9s 2022-05-28 16:54:44 +08:00
parent 4f0ac41850
commit 6b17ba826b
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -6,7 +6,8 @@ You should send multiple small pull request to implement them.
**Please avoid sending a pull request with huge changes** **Please avoid sending a pull request with huge changes**
**Important** -- for the underlying http API please use `requestgen` <https://github.com/c9s/requestgen> to generate the requests. **Important** -- for the underlying http API please use `requestgen` <https://github.com/c9s/requestgen> to generate the
requests.
## Checklist ## Checklist
@ -35,27 +36,27 @@ Back-testing service - kline data is used for back-testing
Convert functions: Convert functions:
- [ ] MarketData convert functions - [ ] MarketData convert functions
- [ ] toGlobalMarket - [ ] toGlobalMarket
- [ ] toGlobalTicker - [ ] toGlobalTicker
- [ ] toGlobalKLine - [ ] toGlobalKLine
- [ ] UserData convert functions - [ ] UserData convert functions
- [ ] toGlobalOrder - [ ] toGlobalOrder
- [ ] toGlobalTrade - [ ] toGlobalTrade
- [ ] toGlobalAccount - [ ] toGlobalAccount
- [ ] toGlobalBalance - [ ] toGlobalBalance
Stream Stream
- [ ] UserDataStream - [ ] UserDataStream
- [ ] Trade message parser - [ ] Trade message parser
- [ ] Order message parser - [ ] Order message parser
- [ ] Account message parser - [ ] Account message parser
- [ ] Balance message parser - [ ] Balance message parser
- [ ] MarketDataStream - [ ] MarketDataStream
- [ ] OrderBook message parser (or depth) - [ ] OrderBook message parser (or depth)
- [ ] KLine message parser (required for backtesting) - [ ] KLine message parser (required for backtesting)
- [ ] Public trade message parser (optional) - [ ] Public trade message parser (optional)
- [ ] Ticker message parser (optional) - [ ] Ticker message parser (optional)
- [ ] ping/pong handling. - [ ] ping/pong handling.
- [ ] heart-beat hanlding or keep-alive handling. - [ ] heart-beat hanlding or keep-alive handling.
- [ ] handling reconnect - [ ] handling reconnect
@ -63,8 +64,8 @@ Stream
Database Database
- [ ] Add a new kline table for the exchange (this is required for back-testing) - [ ] Add a new kline table for the exchange (this is required for back-testing)
- [ ] Add MySQL migration SQL - [ ] Add MySQL migration SQL
- [ ] Add SQLite migration SQL - [ ] Add SQLite migration SQL
Exchange Factory Exchange Factory
@ -112,6 +113,29 @@ func NewExchangeStandard(n types.ExchangeName, key, secret, passphrase, subAccou
} }
``` ```
## Un-marshalling Timestamps
For millisecond timestamps, you can use `types.MillisecondTimestamp`, it will automatically convert the timestamp into
time.Time:
```
type MarginInterestRecord struct {
Currency string `json:"currency"`
CreatedAt types.MillisecondTimestamp `json:"created_at"`
}
```
## Un-marshalling numbers
For number fields, especially floating numbers, please use `fixedpoint.Value`, it can parse int, float64, float64 in
string:
```
type A struct {
Amount fixedpoint.Value `json:"amount"`
}
```
## Test Market Data Stream ## Test Market Data Stream
### Test order book stream ### Test order book stream
@ -126,7 +150,6 @@ godotenv -f .env.local -- go run ./cmd/bbgo orderbook --config config/bbgo.yaml
godotenv -f .env.local -- go run ./cmd/bbgo --config config/bbgo.yaml userdatastream --session kucoin godotenv -f .env.local -- go run ./cmd/bbgo --config config/bbgo.yaml userdatastream --session kucoin
``` ```
## Test Restful Endpoints ## Test Restful Endpoints
You can choose the session name to set-up for testing: You can choose the session name to set-up for testing: