Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions adapt/adapt.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func NewSecurities(codes []string) []*qotcommon.Security {

// SecurityToCode converts a Security to a code string, e.g. "HK.00700".
func SecurityToCode(s *qotcommon.Security) string {
if s == nil {
return ""
}
return GetMarketName(s.GetMarket()) + "." + s.GetCode()
}

Expand Down Expand Up @@ -125,7 +128,9 @@ func NewCustomIndicatorFilter(opts ...Option) *qotstockfilter.CustomIndicatorFil
o["isNoFilter"] = false

var f qotstockfilter.CustomIndicatorFilter
_ = o.ToProto(&f)
if err := o.ToProto(&f); err != nil {
return nil
}

return &f
}
Expand All @@ -134,7 +139,9 @@ func NewCustomIndicatorFilter(opts ...Option) *qotstockfilter.CustomIndicatorFil
func NewFilterConditions(opts ...Option) *trdcommon.TrdFilterConditions {
o := NewOptions(opts...)
var f trdcommon.TrdFilterConditions
_ = o.ToProto(&f)
if err := o.ToProto(&f); err != nil {
return nil
}

return &f
}
8 changes: 4 additions & 4 deletions client/quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,13 +805,13 @@ func (client *Client) QotGetMarketState(ctx context.Context, c2s *qotgetmarketst
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-client.closed:
return nil, ErrInterrupted
case resp, ok := <-ch:
if !ok {
return nil, ErrChannelClosed
}
return resp.GetS2C(), infra.Error(resp)
case <-client.closed:
return nil, ErrInterrupted
}
}

Expand All @@ -830,12 +830,12 @@ func (client *Client) QotGetOptionExpirationDate(ctx context.Context, c2s *qotge
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-client.closed:
return nil, ErrInterrupted
case resp, ok := <-ch:
if !ok {
return nil, ErrChannelClosed
}
return resp.GetS2C(), infra.Error(resp)
case <-client.closed:
return nil, ErrInterrupted
}
}
2 changes: 1 addition & 1 deletion client/trade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func (ts *ClientTestSuite) TestTrdGetAccList_TrdGetFunds() {
}

ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
res, err := ts.client.TrdGetFunds(ctx, c2s)
cancel()
should.NoError(err)
log.Info().Interface("data", res.GetFunds()).Msg("TrdGetFunds")
}
Expand Down
4 changes: 2 additions & 2 deletions sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (sdk *SDK) GetPositionList(header *trdcommon.TrdHeader, opts ...adapt.Optio
return sdk.GetPositionListWithContext(ctx, header, opts...)
}

// GetOrderList 2111 - gets the maximum available trading quantities.
// GetMaxTrdQtys 2111 - gets the maximum available trading quantities.
//
// header: trading header
//
Expand Down Expand Up @@ -193,7 +193,7 @@ func (sdk *SDK) ModifyOrder(header *trdcommon.TrdHeader, orderID uint64, modifyO
return sdk.ModifyOrderWithContext(ctx, header, orderID, modifyOrderOp, opts...)
}

// GetHistoryOrderList 2211 - gets the filled order list.
// GetOrderFillList 2211 - gets the filled order list.
func (sdk *SDK) GetOrderFillList(header *trdcommon.TrdHeader, opts ...adapt.Option) ([]*trdcommon.OrderFill, error) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
defer cancel()
Expand Down
Loading