This PR adds support for TimeInForce. Different exchanges have different ways of supporting this.
Nash supports GTC, IOC, FOK and GTT. GTT supports any timestamp as parameter.
Coinbase supports GTC, IOC, FOK, GTT. GTT only supports three durations: 1 Minute, 1 Hour and 1 day.
Binance only supports GTC, IOC, FOK.
I feel the most cross exchange way of supporting this would be to represent the GTC, IOC and FOK as normal enums, and GTT as a duration. This would fit the Coinbase model, and for nash the timestamp can be converted by doing a simple current_time + duration calculation.
pub enum TimeInForce {
GoodTillCancelled,
ImmediateOrCancelled,
FillOrKill,
// Representing 'good till time' as a duration works for both Nash and Coinbase
GoodTillTime(Duration),
}
This PR also fixes two bugs I found while testing the Coinbase and Binance implementations. Our naivetimestamp deserialization code sometimes fails if the timestamp lands on a whole milisecond. Our Binance client had an endless loop in the get_all_open_orders call.
This PR adds support for TimeInForce. Different exchanges have different ways of supporting this.
I feel the most cross exchange way of supporting this would be to represent the GTC, IOC and FOK as normal enums, and GTT as a duration. This would fit the Coinbase model, and for nash the timestamp can be converted by doing a simple
current_time + duration
calculation.This PR also fixes two bugs I found while testing the Coinbase and Binance implementations. Our naivetimestamp deserialization code sometimes fails if the timestamp lands on a whole milisecond. Our Binance client had an endless loop in the
get_all_open_orders
call.closes #104