Skip to content

Commit 77b595c

Browse files
author
evzpav
committed
add reduce only flag to order request
1 parent 9e0b26f commit 77b595c

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

pkg/models/common/common.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
const (
99
OrderFlagHidden int = 64
1010
OrderFlagClose int = 512
11+
OrderFlagReduceOnly int = 1024
1112
OrderFlagPostOnly int = 4096
1213
OrderFlagOCO int = 16384
1314
Checksum int = 131072

pkg/models/order/orderrequests.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type NewRequest struct {
2222
PriceOcoStop float64 `json:"price_oco_stop,string,omitempty"`
2323
Hidden bool `json:"hidden,omitempty"`
2424
PostOnly bool `json:"postonly,omitempty"`
25+
ReduceOnly bool `json:"reduceonly,omitempty"`
2526
Close bool `json:"close,omitempty"`
2627
OcoOrder bool `json:"oco_order,omitempty"`
2728
TimeInForce string `json:"tif,omitempty"`
@@ -77,6 +78,10 @@ func (nr *NewRequest) EnrichedPayload() interface{} {
7778
pld.Flags = pld.Flags + common.OrderFlagPostOnly
7879
}
7980

81+
if nr.ReduceOnly {
82+
pld.Flags = pld.Flags + common.OrderFlagReduceOnly
83+
}
84+
8085
if nr.OcoOrder {
8186
pld.Flags = pld.Flags + common.OrderFlagOCO
8287
}

v2/rest/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ type Client struct {
5252
Pulse PulseService
5353
Invoice InvoiceService
5454
Market MarketService
55-
5655
Synchronous
5756
}
5857

@@ -100,11 +99,11 @@ func NewClientWithURL(url string) *Client {
10099

101100
// Create a new Rest client with a synchronous HTTP handler and a custom nonce generaotr
102101
func NewClientWithSynchronousNonce(sync Synchronous, nonce utils.NonceGenerator) *Client {
103-
return NewClientWithSynchronousURLNonce(sync, productionBaseURL, nonce)
102+
return NewClientWithSynchronousURLNonce(sync, nonce)
104103
}
105104

106105
// Create a new Rest client with a synchronous HTTP handler and a custom base url and nonce generator
107-
func NewClientWithSynchronousURLNonce(sync Synchronous, url string, nonce utils.NonceGenerator) *Client {
106+
func NewClientWithSynchronousURLNonce(sync Synchronous, nonce utils.NonceGenerator) *Client {
108107
c := &Client{
109108
Synchronous: sync,
110109
nonce: nonce,

0 commit comments

Comments
 (0)