mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
max: pass context background to the request
This commit is contained in:
parent
5cba6a6133
commit
4d8997a8d5
|
@ -72,7 +72,7 @@ type VipLevel struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AccountService) VipLevel() (*VipLevel, error) {
|
func (s *AccountService) VipLevel() (*VipLevel, error) {
|
||||||
req, err := s.client.newAuthenticatedRequest(nil, "GET", "v2/members/vip_level", nil, nil, nil)
|
req, err := s.client.newAuthenticatedRequest(context.Background(), "GET", "v2/members/vip_level", nil, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ func (s *AccountService) VipLevel() (*VipLevel, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AccountService) Account(currency string) (*Account, error) {
|
func (s *AccountService) Account(currency string) (*Account, error) {
|
||||||
req, err := s.client.newAuthenticatedRequest(nil, "GET", "v2/members/accounts/"+currency, nil, nil, nil)
|
req, err := s.client.newAuthenticatedRequest(context.Background(), "GET", "v2/members/accounts/"+currency, nil, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ func (s *AccountService) NewAccountsRequest() *GetAccountsRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AccountService) Accounts() ([]Account, error) {
|
func (s *AccountService) Accounts() ([]Account, error) {
|
||||||
req, err := s.client.newAuthenticatedRequest(nil, "GET", "v2/members/accounts", nil, nil, nil)
|
req, err := s.client.newAuthenticatedRequest(context.Background(), "GET", "v2/members/accounts", nil, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ func (s *AccountService) Accounts() ([]Account, error) {
|
||||||
|
|
||||||
// Me returns the current user info by the current used MAX key and secret
|
// Me returns the current user info by the current used MAX key and secret
|
||||||
func (s *AccountService) Me() (*UserInfo, error) {
|
func (s *AccountService) Me() (*UserInfo, error) {
|
||||||
req, err := s.client.newAuthenticatedRequest(nil, "GET", "v2/members/me", nil, nil, nil)
|
req, err := s.client.newAuthenticatedRequest(context.Background(), "GET", "v2/members/me", nil, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ func (r *GetDepositHistoryRequest) To(to int64) *GetDepositHistoryRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *GetDepositHistoryRequest) Do(ctx context.Context) (deposits []Deposit, err error) {
|
func (r *GetDepositHistoryRequest) Do(ctx context.Context) (deposits []Deposit, err error) {
|
||||||
req, err := r.client.newAuthenticatedRequest(nil, "GET", "v2/deposits", nil, &r.params, nil)
|
req, err := r.client.newAuthenticatedRequest(context.Background(), "GET", "v2/deposits", nil, &r.params, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return deposits, err
|
return deposits, err
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ func (r *GetWithdrawHistoryRequest) To(to int64) *GetWithdrawHistoryRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *GetWithdrawHistoryRequest) Do(ctx context.Context) (withdraws []Withdraw, err error) {
|
func (r *GetWithdrawHistoryRequest) Do(ctx context.Context) (withdraws []Withdraw, err error) {
|
||||||
req, err := r.client.newAuthenticatedRequest(nil, "GET", "v2/withdrawals", nil, &r.params, nil)
|
req, err := r.client.newAuthenticatedRequest(context.Background(), "GET", "v2/withdrawals", nil, &r.params, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return withdraws, err
|
return withdraws, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ func (s *OrderService) Closed(market string, options QueryOrderOptions) ([]Order
|
||||||
payload["order_by"] = options.OrderBy
|
payload["order_by"] = options.OrderBy
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := s.client.newAuthenticatedRequest(nil, "GET", "v2/orders", nil, payload, relUrlV2Orders)
|
req, err := s.client.newAuthenticatedRequest(context.Background(), "GET", "v2/orders", nil, payload, relUrlV2Orders)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ func (s *OrderService) Open(market string, options QueryOrderOptions) ([]Order,
|
||||||
payload["group_id"] = options.GroupID
|
payload["group_id"] = options.GroupID
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := s.client.newAuthenticatedRequest(nil, "GET", "v2/orders", nil, payload, relUrlV2Orders)
|
req, err := s.client.newAuthenticatedRequest(context.Background(), "GET", "v2/orders", nil, payload, relUrlV2Orders)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ func (s *OrderService) All(market string, limit, page int, states ...OrderState)
|
||||||
"order_by": "desc",
|
"order_by": "desc",
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := s.client.newAuthenticatedRequest(nil, "GET", "v2/orders", nil, payload, relUrlV2Orders)
|
req, err := s.client.newAuthenticatedRequest(context.Background(), "GET", "v2/orders", nil, payload, relUrlV2Orders)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ func (r *CreateMultiOrderRequest) Do(ctx context.Context) (multiOrderResponse *M
|
||||||
|
|
||||||
payload["orders"] = r.orders
|
payload["orders"] = r.orders
|
||||||
|
|
||||||
req, err := r.client.newAuthenticatedRequest(nil, "POST", "v2/orders/multi/onebyone", nil, payload, relUrlV2OrdersMultiOneByOne)
|
req, err := r.client.newAuthenticatedRequest(context.Background(), "POST", "v2/orders/multi/onebyone", nil, payload, relUrlV2OrdersMultiOneByOne)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return multiOrderResponse, errors.Wrapf(err, "order create error")
|
return multiOrderResponse, errors.Wrapf(err, "order create error")
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ func (r *RewardsRequest) Do(ctx context.Context) (rewards []Reward, err error) {
|
||||||
refURL += "/" + string(*r.pathType)
|
refURL += "/" + string(*r.pathType)
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := r.client.newAuthenticatedRequest(nil, "GET", refURL, nil, payload, nil)
|
req, err := r.client.newAuthenticatedRequest(context.Background(), "GET", refURL, nil, payload, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return rewards, err
|
return rewards, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,7 @@ func (r *PrivateTradeRequest) Do(ctx context.Context) (trades []Trade, err error
|
||||||
payload["offset"] = r.offset
|
payload["offset"] = r.offset
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := r.client.newAuthenticatedRequest(nil, "GET", "v2/trades/my", nil, payload, nil)
|
req, err := r.client.newAuthenticatedRequest(context.Background(), "GET", "v2/trades/my", nil, payload, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return trades, err
|
return trades, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ func (r *WithdrawalRequest) Do(ctx context.Context) (*Withdraw, error) {
|
||||||
"amount": r.amount,
|
"amount": r.amount,
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := r.client.newAuthenticatedRequest(nil, "POST", "v2/withdrawal", nil, payload, nil)
|
req, err := r.client.newAuthenticatedRequest(context.Background(), "POST", "v2/withdrawal", nil, payload, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ func (r *GetWithdrawalAddressesRequest) Do(ctx context.Context) ([]WithdrawalAdd
|
||||||
"currency": r.currency,
|
"currency": r.currency,
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := r.client.newAuthenticatedRequest(nil, "GET", "v2/withdraw_addresses", nil, payload, nil)
|
req, err := r.client.newAuthenticatedRequest(context.Background(), "GET", "v2/withdraw_addresses", nil, payload, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user