forked from dwdwow/cex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrader.go
35 lines (29 loc) · 1.92 KB
/
trader.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cex
import (
"context"
"github.com/go-resty/resty/v2"
)
type SimpleTraderFunc func(OrderType, OrderSide, string, string, float64, float64, ...CltOpt) (*resty.Response, *Order, RequestError)
type LimitTraderFunc func(string, string, float64, float64, ...CltOpt) (*resty.Response, *Order, RequestError)
type MarketTraderFunc func(string, string, float64, ...CltOpt) (*resty.Response, *Order, RequestError)
type SpotTrader interface {
NewSpotOrder(asset, quote string, tradeType OrderType, side OrderSide, qty, price float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
NewSpotLimitBuyOrder(asset, quote string, qty, price float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
NewSpotLimitSellOrder(asset, quote string, qty, price float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
NewSpotMarketBuyOrder(asset, quote string, qty float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
NewSpotMarketSellOrder(asset, quote string, qty float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
}
type FuTrader interface {
NewFuturesOrder(asset, quote string, tradeType OrderType, side OrderSide, qty, price float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
NewFuturesLimitBuyOrder(asset, quote string, qty, price float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
NewFuturesLimitSellOrder(asset, quote string, qty, price float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
NewFuturesMarketBuyOrder(asset, quote string, qty float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
NewFuturesMarketSellOrder(asset, quote string, qty float64, opts ...CltOpt) (*resty.Response, *Order, RequestError)
}
type Trader interface {
QueryOrder(*Order, ...CltOpt) (*resty.Response, RequestError)
CancelOrder(*Order, ...CltOpt) (*resty.Response, RequestError)
WaitOrder(context.Context, *Order, ...CltOpt) chan RequestError
SpotTrader
FuTrader
}