Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
nntaoli committed May 25, 2020
2 parents 68fcdbf + 1238cca commit 66f2abd
Show file tree
Hide file tree
Showing 32 changed files with 612 additions and 2,087 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"env": {},
"args": []
}
]
}
15 changes: 15 additions & 0 deletions Models.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,21 @@ type HistoricalFunding struct {
FundingTime time.Time `json:"funding_time"`
}

type TickSize struct {
InstrumentID string
UnderlyingIndex string
QuoteCurrency string
PriceTickSize float64 //下单价格精度
AmountTickSize float64 //数量精度
}

type FuturesContractInfo struct {
*TickSize
ContractVal float64 //合约面值(美元)
Delivery string //交割日期
ContractType string // 本周 this_week 次周 next_week 季度 quarter
}

//api parameter struct

type BorrowParameter struct {
Expand Down
4 changes: 2 additions & 2 deletions Utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ func ValuesToJson(v url.Values) ([]byte, error) {
return json.Marshal(parammap)
}

func GzipUnCompress(data []byte) ([]byte, error) {
func GzipDecompress(data []byte) ([]byte, error) {
r, err := gzip.NewReader(bytes.NewReader(data))
if err != nil {
return nil, err
}
return ioutil.ReadAll(r)
}

func FlateUnCompress(data []byte) ([]byte, error) {
func FlateDecompress(data []byte) ([]byte, error) {
return ioutil.ReadAll(flate.NewReader(bytes.NewReader(data)))
}

Expand Down
35 changes: 35 additions & 0 deletions WsApi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package goex

type FuturesWsApi interface {
DepthCallback(func(depth *Depth))
TickerCallback(func(ticker *FutureTicker))
TradeCallback(func(trade *Trade, contract string))
//OrderCallback(func(order *FutureOrder))
//PositionCallback(func(position *FuturePosition))
//AccountCallback(func(account *FutureAccount))

SubscribeDepth(pair CurrencyPair, contractType string) error
SubscribeTicker(pair CurrencyPair, contractType string) error
SubscribeTrade(pair CurrencyPair, contractType string) error

//Login() error
//SubscribeOrder(pair CurrencyPair, contractType string) error
//SubscribePosition(pair CurrencyPair, contractType string) error
//SubscribeAccount(pair CurrencyPair) error
}

type SpotWsApi interface {
DepthCallback(func(depth *Depth))
TickerCallback(func(ticker *Ticker))
TradeCallback(func(trade *Trade))
//OrderCallback(func(order *Order))
//AccountCallback(func(account *Account))

SubscribeDepth(pair CurrencyPair) error
SubscribeTicker(pair CurrencyPair) error
SubscribeTrade(pair CurrencyPair) error

//Login() error
//SubscribeOrder(pair CurrencyPair) error
//SubscribeAccount(pair CurrencyPair) error
}
Loading

0 comments on commit 66f2abd

Please sign in to comment.