Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3de164c53 |
No files matched your search
@@ -24,7 +24,7 @@ static class ExchangeSpecificUitlities{
|
||||
}
|
||||
|
||||
public static bool is_ice_lots(SecurityImmutable sec){
|
||||
return sec.Ice.MarketDescription.Contains("ICE Lots");
|
||||
return sec.Ice.IsIceLots;
|
||||
}
|
||||
|
||||
public static bool is_tas(SecurityImmutable sec){
|
||||
@@ -33,25 +33,36 @@ static class ExchangeSpecificUitlities{
|
||||
|
||||
#endregion
|
||||
|
||||
#region CPP
|
||||
#region CPP
|
||||
public static double get_future_cpp (SecurityImmutable sec){
|
||||
if(sec.Symbol == "HHD")
|
||||
// only futures in HHD are the dailies, everything
|
||||
// else is a strip or spread
|
||||
return 1;
|
||||
// TODO, this should be part of the security
|
||||
if(sec.Symbol == "HHD")
|
||||
return 2500;
|
||||
if(is_ice_lots(sec))
|
||||
return 2500;
|
||||
else{
|
||||
var days_in_month = DateTime.DaysInMonth(Convert.ToInt32(sec.Future.ExpirationYear),
|
||||
Convert.ToInt32(sec.Future.ExpirationMonth));
|
||||
return days_in_month; // because the size is multiplied by 2500 already
|
||||
// other futures - HNG, HHD, HEN - are like daily
|
||||
// strips
|
||||
UInt32 days_in_month = 31;
|
||||
var mm = sec.Future.ExpirationMonth;
|
||||
if(mm <=11)
|
||||
days_in_month = Convert.ToUInt32(
|
||||
DateTime.DaysInMonth(
|
||||
Convert.ToInt32(sec.Future.ExpirationYear),
|
||||
// expects 1-12
|
||||
Convert.ToInt32(sec.Future.ExpirationMonth+1)));
|
||||
else
|
||||
// TODO : sometimes Jan is 12 !
|
||||
days_in_month = 31;
|
||||
return days_in_month * 2500;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static double get_spread_cpp(SecurityImmutable sec){
|
||||
// for purpose of pnl we are 0'ing out the spread pnl
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public static double get_strip_cpp(PNLUnitImmutable pnl,
|
||||
SecurityImmutable sec){
|
||||
// add up all the legs
|
||||
|
||||
@@ -223,9 +223,24 @@ inline bool test_price_equality(double price_1, double price_2) {
|
||||
|
||||
static const uint32_t days_in_month[] = {31,28,31,30,31,30,31,31,30,31,30,31};
|
||||
|
||||
inline Quantity from_exchange_qty (Quantity exchange_qty,
|
||||
const bts::api::Security& sec){
|
||||
return Quantity(exchange_qty.value()/sec.ice().exchange_qty_mult());
|
||||
}
|
||||
|
||||
inline Quantity to_exchange_qty (Quantity internal_qty,
|
||||
const bts::api::Security& sec){
|
||||
return Quantity(internal_qty.value()*sec.ice().exchange_qty_mult());
|
||||
}
|
||||
|
||||
inline bool is_spread(const bts::api::Security& sec){
|
||||
return sec.has_ice() && sec.has_spread() &&
|
||||
sec.ice().strip_name().find("/") != std::string::npos;
|
||||
}
|
||||
|
||||
inline bool is_strip(const bts::api::Security& sec){
|
||||
auto rv = sec.has_ice() && sec.has_spread() &&
|
||||
sec.ice().strip_name().find("/") != std::string::npos;
|
||||
!is_spread(sec);
|
||||
if(rv != sec.ice().is_strip())
|
||||
LOG(OrderMan, Error, "Sec:{} is_strip incorrect, expected:{}",
|
||||
sec.id(),rv);
|
||||
@@ -258,7 +273,7 @@ inline bool is_daily_contract(const api::Security& s){
|
||||
// daily futures and ice lots are considered 1,
|
||||
// other futures (HNG,HIS,HEN etc) are the days
|
||||
// in the month
|
||||
inline double get_fut_risk_qty(const api::Security& s){
|
||||
inline uint32_t get_fut_risk_qty(const api::Security& s){
|
||||
bts_assert(s.has_future());
|
||||
bts_assert(s.has_ice());
|
||||
if(is_daily_contract(s))
|
||||
@@ -279,7 +294,7 @@ inline double get_fut_risk_qty(const api::Security& s){
|
||||
}
|
||||
}
|
||||
|
||||
inline double get_spread_direct_risk_qty(const api::Security& s){
|
||||
inline uint32_t get_spread_direct_risk_qty(const api::Security& s){
|
||||
bts_assert(s.has_spread());
|
||||
bts_assert(s.has_ice());
|
||||
if(s.ice().is_ice_lots())
|
||||
@@ -288,7 +303,7 @@ inline double get_spread_direct_risk_qty(const api::Security& s){
|
||||
return 30;
|
||||
}
|
||||
|
||||
inline double get_risk_qty (const api::Security& s){
|
||||
inline uint32_t get_risk_qty (const api::Security& s){
|
||||
if(s.has_future())
|
||||
return get_fut_risk_qty(s);
|
||||
else if (s.has_spread())
|
||||
|
||||
@@ -118,7 +118,7 @@ message ICEExchangeData {
|
||||
bool is_strip = 160;
|
||||
bool is_ice_lots = 170;
|
||||
// for example 2500 for HNG, this is the qty the exchange needs to see
|
||||
double exchange_qty_ratio = 180;
|
||||
uint32 exchange_qty_mult = 180;
|
||||
}
|
||||
|
||||
message FutureContract {
|
||||
|
||||
@@ -36,6 +36,7 @@ FixedSecurity::FixedSecurity() :
|
||||
ice_settle_denominator(0),
|
||||
is_ice_strip(false),
|
||||
is_ice_lots(false),
|
||||
ice_exchange_qty_mult(1),
|
||||
_symbol(),
|
||||
_cfi_code(),
|
||||
_security_desc(),
|
||||
@@ -99,19 +100,6 @@ void write_leg_descriptor(std::ostringstream& result, char separator, const api:
|
||||
<< leg.leg_delta() << (leg.side() == SIDE_BUY ? "BUY" : "SELL");
|
||||
}
|
||||
|
||||
// for ice sec's it populates exchange_qty_ratio and
|
||||
// net_
|
||||
void populate_derivable_fields (api::Security& s){
|
||||
if (s.has_ice()){
|
||||
auto& ice = *s.mutable_ice();
|
||||
if(!ice.is_ice_lots())
|
||||
// TODO : get this from config
|
||||
ice.set_exchange_qty_ratio(2500);
|
||||
else
|
||||
ice.set_exchange_qty_ratio(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
std::string security_descriptor(const api::Security& security) {
|
||||
const char separator = ' ';
|
||||
std::ostringstream result;
|
||||
@@ -212,6 +200,7 @@ void convert_security(const FixedSecurity& source, Security* presult) {
|
||||
dest.mutable_ice()->set_mic_code(source.mic_code());
|
||||
dest.mutable_ice()->set_is_strip(source.is_ice_strip);
|
||||
dest.mutable_ice()->set_is_ice_lots(source.is_ice_lots);
|
||||
dest.mutable_ice()->set_exchange_qty_mult(source.ice_exchange_qty_mult);
|
||||
break;
|
||||
case Venue::VENUE_BTS:
|
||||
break;
|
||||
@@ -269,7 +258,6 @@ void convert_security(const FixedSecurity& source, Security* presult) {
|
||||
break;
|
||||
}
|
||||
get_contract_spec(source, *dest.mutable_contract_spec());
|
||||
populate_derivable_fields(*presult);
|
||||
}
|
||||
|
||||
SecurityType securitytype_of_contractcase(Security::ContractCase cc) {
|
||||
@@ -339,6 +327,7 @@ void convert_security(const Security& src, FixedSecurity& dest, bool set_securit
|
||||
dest.ice_settle_denominator = src.ice().settle_denominator();
|
||||
dest.is_ice_strip = src.ice().is_strip();
|
||||
dest.is_ice_lots = src.ice().is_ice_lots();
|
||||
dest.ice_exchange_qty_mult = src.ice().exchange_qty_mult();
|
||||
|
||||
dest.ice_market_description(src.ice().market_description());
|
||||
dest.ice_cleared_alias(src.ice().cleared_alias());
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
int8_t ice_settle_denominator;
|
||||
bool is_ice_strip;
|
||||
bool is_ice_lots;
|
||||
uint32_t ice_exchange_qty_mult;
|
||||
|
||||
STRING_PROPERTY(ice_market_description);
|
||||
STRING_PROPERTY(ice_cleared_alias);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "lib/utils/helper_macros.h"
|
||||
#include "lib/utils/Dispatcher.h"
|
||||
#include "lib/utils/bts_chrono.h"
|
||||
#include "lib/domain_model/Security.h"
|
||||
|
||||
#include <boost/pool/object_pool.hpp>
|
||||
#include <atomic>
|
||||
@@ -59,6 +60,17 @@ struct ICEExecutionGateway::PImpl
|
||||
md::SecurityOracle sec_oracle;
|
||||
};
|
||||
|
||||
void from_exchange_qty (const api::Security& sec, bts::orderman::ExecutionReport* exec_rep){
|
||||
exec_rep->quantity = bts::securities::from_exchange_qty(
|
||||
exec_rep->quantity,sec);
|
||||
exec_rep->filled_quantity = bts::securities::from_exchange_qty(
|
||||
exec_rep->filled_quantity,sec);
|
||||
exec_rep->last_shares = bts::securities::from_exchange_qty(
|
||||
exec_rep->last_shares,sec);
|
||||
exec_rep->max_show = bts::securities::from_exchange_qty(
|
||||
exec_rep->max_show,sec);
|
||||
}
|
||||
|
||||
ICEExecutionGateway::ICEExecutionGateway(const config::JetFIX::Connection &cfg, trace::PerfLog &log, md::SecurityOracle o)
|
||||
: IExecutionGateway(), me(new PImpl(cfg, log, o))
|
||||
{
|
||||
@@ -420,6 +432,7 @@ void ICEExecutionGateway::on_exe_report(const jetfix::fix::ICEExecutionReportMsg
|
||||
data->last_shares = msg.has<fix::LastShares>()
|
||||
? Quantity(msg.get<fix::LastShares>())
|
||||
: Quantity(0);
|
||||
from_exchange_qty(*sec,data);
|
||||
auto last_px_sec = data->leg_security ? data->leg_security : sec;
|
||||
data->last_price = msg.has<fix::LastPx>()
|
||||
? securities::decode_exchange_price(*last_px_sec, Price(msg.get<fix::LastPx>()))
|
||||
|
||||
@@ -11,7 +11,7 @@ SecurityLimitTree::QtyNormalization get_qty_norm (const api::Security& s){
|
||||
if(s.has_ice())
|
||||
return SecurityLimitTree::QtyNormalization
|
||||
{
|
||||
s.ice().exchange_qty_ratio(),
|
||||
s.ice().exchange_qty_mult(),
|
||||
bts::securities::get_risk_qty(s)
|
||||
};
|
||||
else
|
||||
@@ -29,7 +29,7 @@ SecurityLimitTree::SecurityLimitTree(
|
||||
_qty_norm(get_qty_norm(security)){
|
||||
LOG(OrderMan,Info,"SecurityLimitTree sec:{} qty_ratio:{} risk_qty:{}",
|
||||
security.id(),
|
||||
_qty_norm.exchange_qty_ratio,
|
||||
_qty_norm.exchange_qty_mult,
|
||||
_qty_norm.unit_risk_qty);
|
||||
for (const auto &account : admin_data.accounts()) {
|
||||
ProductLimitNode *product_node_ptr =
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
// is entered in different terms than what the order management
|
||||
// system (and exchange) deal with.
|
||||
// This is a 2 step process
|
||||
// exchange_qty_ratio : exchange deals with qty's that are
|
||||
// exchange_qty_mult : exchange deals with qty's that are
|
||||
// different than what the ui (both trading and risk)
|
||||
// deals with. for example HNG at ICE
|
||||
// is multiple of 2500, but the ui shows it
|
||||
@@ -33,8 +33,8 @@ public:
|
||||
// the risk for HNG is entered in terms of the ICE lot,
|
||||
// for HHD it is entered in terms of the daily future etc.
|
||||
struct QtyNormalization{
|
||||
const double exchange_qty_ratio = 1;
|
||||
const double unit_risk_qty = 1;
|
||||
const uint32_t exchange_qty_mult = 1;
|
||||
const uint32_t unit_risk_qty = 1;
|
||||
};
|
||||
private:
|
||||
const SecurityKey _sec_key;
|
||||
@@ -149,9 +149,7 @@ private:
|
||||
return nullptr;
|
||||
}
|
||||
Quantity _convert_qty (Quantity qty) const{
|
||||
auto v = qty.value();
|
||||
auto v_out =(v/_qty_norm.exchange_qty_ratio)*_qty_norm.unit_risk_qty;
|
||||
return Quantity(v_out);
|
||||
return Quantity(qty.value() *_qty_norm.unit_risk_qty);
|
||||
}
|
||||
};
|
||||
}}
|
||||
@@ -79,6 +79,13 @@ struct ICENativeOrder::PImpl
|
||||
int buffered_tries = 0;
|
||||
};
|
||||
|
||||
// on outgoing order, converts the qty to exchange terms
|
||||
// (ex HNG that is represented as 1 in the system and
|
||||
// multiples of 2500 at ICE)
|
||||
Quantity to_exchange_qty (const api::Security& sec, Quantity internal_qty){
|
||||
return bts::securities::to_exchange_qty(internal_qty,sec);
|
||||
}
|
||||
|
||||
ICENativeOrder::ICENativeOrder() : me(new PImpl()) {}
|
||||
|
||||
const OrderDefinition& ICENativeOrder::definition() const
|
||||
@@ -349,10 +356,10 @@ void ICENativeOrder::warm_up_activate(OrderServicesData &data, OrderServices &se
|
||||
|
||||
OrderOpResult
|
||||
ICENativeOrder::_on_activate(log::Level reject_level, log::Level transition_level,
|
||||
Price p, Quantity q, bts::orderman::OrderServices &services)
|
||||
Price p, Quantity activate_q, bts::orderman::OrderServices &services)
|
||||
{
|
||||
me->state.set_price(p.value());
|
||||
me->state.set_quantity(q.value());
|
||||
me->state.set_quantity(activate_q.value());
|
||||
me->state.set_filled_quantity(0);
|
||||
me->state.set_last_price(0);
|
||||
me->state.set_avg_price(0);
|
||||
@@ -387,7 +394,7 @@ ICENativeOrder::_on_activate(log::Level reject_level, log::Level transition_leve
|
||||
}
|
||||
|
||||
// can we trade this security, with this size?
|
||||
lqr = me->services->limiter().can_send_new_order( AccountID(me->definition.account_id()), *me->sec, me->definition.side(), q );
|
||||
lqr = me->services->limiter().can_send_new_order( AccountID(me->definition.account_id()), *me->sec, me->definition.side(), activate_q);
|
||||
|
||||
if (!lqr.ok())
|
||||
{
|
||||
@@ -444,8 +451,8 @@ ICENativeOrder::_on_activate(log::Level reject_level, log::Level transition_leve
|
||||
bts_assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
me->create_quantity_bm = encoding.overwrite(me->create_quantity_bm, q.value(), quantity_sz());
|
||||
auto exchange_qty = to_exchange_qty(*me->sec,activate_q);
|
||||
me->create_quantity_bm = encoding.overwrite(me->create_quantity_bm, exchange_qty.value(), quantity_sz());
|
||||
const auto &ts = services.get_time_str();
|
||||
me->create_transact_time_bm = encoding.overwrite(me->create_transact_time_bm, &ts.value()[0], ts.value().size());
|
||||
return OrderOpResult{};
|
||||
@@ -550,7 +557,7 @@ OrderOpResult ICENativeOrder::on_update(Price p, Quantity q)
|
||||
OrderOpResult ICENativeOrder::on_update(api::orderman::Update const &update)
|
||||
{
|
||||
auto p = Price(update.price());
|
||||
auto q = Quantity(update.quantity());
|
||||
auto update_q = Quantity(update.quantity());
|
||||
auto scoped_log = me->services->log_scope("ICENativeOrder::on_update", key().value());
|
||||
auto result = OrderOpResult{};
|
||||
|
||||
@@ -563,8 +570,8 @@ OrderOpResult ICENativeOrder::on_update(api::orderman::Update const &update)
|
||||
previous_working_qty = me->state.quantity() - me->state.filled_quantity();
|
||||
|
||||
auto current_working_qty = 0;
|
||||
if (q.value() > me->state.filled_quantity())
|
||||
current_working_qty = q.value() - me->state.filled_quantity();
|
||||
if (update_q.value() > me->state.filled_quantity())
|
||||
current_working_qty = update_q.value() - me->state.filled_quantity();
|
||||
|
||||
auto lqr = me->services->limiter().can_update_order( AccountID(me->definition.account_id()), *me->sec,
|
||||
me->definition.side(), Quantity(previous_working_qty),
|
||||
@@ -606,7 +613,8 @@ OrderOpResult ICENativeOrder::on_update(api::orderman::Update const &update)
|
||||
}
|
||||
me->update_price_bm = encoding.overwrite(me->update_price_bm, securities::encode_exchange_price(*me->sec, p).value(),
|
||||
me->price_encoding_precision, price_sz());
|
||||
me->update_quantity_bm = encoding.overwrite(me->update_quantity_bm, q.value(), quantity_sz());
|
||||
auto exchange_qty = to_exchange_qty(*me->sec,update_q);
|
||||
me->update_quantity_bm = encoding.overwrite(me->update_quantity_bm, exchange_qty.value(), quantity_sz());
|
||||
|
||||
const auto &ts = me->services->get_time_str();
|
||||
me->update_transact_time_bm = encoding.overwrite( me->update_transact_time_bm, &ts.value()[0], ts.value().size() );
|
||||
@@ -622,8 +630,8 @@ OrderOpResult ICENativeOrder::on_update(api::orderman::Update const &update)
|
||||
|
||||
LOG(OrderMan, Info,
|
||||
"ICE may not honor this update if we recently issued an unacknowledged cancelreplace {}. Update: {}@{}. Buffering",
|
||||
key().value(), q.value(), p.value());
|
||||
me->buffered_update.emplace(p, q);
|
||||
key().value(), update_q.value(), p.value());
|
||||
me->buffered_update.emplace(p, update_q);
|
||||
|
||||
// early return so we skip report_state (for speed)
|
||||
return OrderOpResult{};
|
||||
@@ -633,8 +641,8 @@ OrderOpResult ICENativeOrder::on_update(api::orderman::Update const &update)
|
||||
case ORDER_STATUS_PENDING_WORKING:
|
||||
LOG(OrderMan, Warn,
|
||||
"Cannot apply update to order {}. Update: {}@{}. Buffering",
|
||||
key().value(), q.value(), p.value());
|
||||
me->buffered_update.emplace(p, q);
|
||||
key().value(), update_q.value(), p.value());
|
||||
me->buffered_update.emplace(p, update_q);
|
||||
break;
|
||||
|
||||
case ORDER_STATUS_REJECTED_BY_SPARK:
|
||||
|
||||
@@ -12,7 +12,7 @@ using namespace bts::md::ice;
|
||||
namespace bts {
|
||||
namespace md {
|
||||
namespace ice {
|
||||
|
||||
|
||||
template <>
|
||||
double double_of_price<onixs_ice::Rational>(const onixs_ice::Rational& price, int8_t denominator)
|
||||
{
|
||||
@@ -175,8 +175,8 @@ void ICEListener::onMarketSnapshot(const onixs_ice::MarketSnapshot& msg, const o
|
||||
data->handle.update_session_high( ts, double_of_price(msg.high, deal_denominator) );
|
||||
data->handle.update_session_low( ts, double_of_price(msg.low, deal_denominator) );
|
||||
|
||||
data->handle.set_last_trade( ts, pricesize_of_price_size(msg.lastTradePrice, deal_denominator, msg.lastTradeQuantity),
|
||||
ll_of_timestamp(msg.lastTradeDateTime), msg.volume );
|
||||
data->handle.set_last_trade( ts, pricesize_of_price_size(msg.lastTradePrice, deal_denominator, msg.lastTradeQuantity,data->handle.security()),
|
||||
ll_of_timestamp(msg.lastTradeDateTime), from_exchange_qty(msg.volume,data->handle.security()) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ void ICEListener::onMarketStatistics(const onixs_ice::MarketStatistics& msg, con
|
||||
bts_assert(data->id == msg.marketId);
|
||||
auto ts = utils::TimeStamp::now();
|
||||
auto deal_denominator = data->handle.security().ice_deal_denominator;
|
||||
data->handle.set_total_volume(msg.volume);
|
||||
data->handle.set_total_volume(from_exchange_qty(msg.volume,data->handle.security()));
|
||||
data->handle.update_session_high( ts, double_of_price(msg.high, deal_denominator) );
|
||||
data->handle.update_session_low( ts, double_of_price(msg.low, deal_denominator) );
|
||||
}
|
||||
@@ -237,17 +237,17 @@ void ICEListener::onOrderBookUpdated(const onixs_ice::OrderBook& onixs_book, con
|
||||
{
|
||||
auto& bid = onixs_book.bids()[x];
|
||||
if(x < COCONUT_MAX_DEPTH)
|
||||
dbids[x] = pricesize_of_price_size(bid.price, denominator, bid.quantity - bid.impliedQuantity);
|
||||
dbids[x] = pricesize_of_price_size(bid.price, denominator, bid.quantity - bid.impliedQuantity,data->handle.security());
|
||||
if(x < COCONUT_MAX_IMPLIED_DEPTH)
|
||||
ibids[x] = pricesize_of_price_size(bid.price, denominator, bid.impliedQuantity);
|
||||
ibids[x] = pricesize_of_price_size(bid.price, denominator, bid.impliedQuantity,data->handle.security());
|
||||
}
|
||||
for (size_t x = 0; x < asks_size; ++x)
|
||||
{
|
||||
auto& ask = onixs_book.offers()[x];
|
||||
if(x < COCONUT_MAX_DEPTH)
|
||||
dasks[x] = pricesize_of_price_size(ask.price, denominator, ask.quantity - ask.impliedQuantity);
|
||||
dasks[x] = pricesize_of_price_size(ask.price, denominator, ask.quantity - ask.impliedQuantity,data->handle.security());
|
||||
if(x < COCONUT_MAX_IMPLIED_DEPTH)
|
||||
iasks[x] = pricesize_of_price_size(ask.price, denominator, ask.impliedQuantity);
|
||||
iasks[x] = pricesize_of_price_size(ask.price, denominator, ask.impliedQuantity,data->handle.security());
|
||||
}
|
||||
data->handle.update_books(TimeStamp::now(), dbids, dasks, ibids, iasks, (uint32_t) msg_info.sequenceNumber);
|
||||
}
|
||||
@@ -272,7 +272,7 @@ void on_trade(ICESecurityData* data, const onixs_ice::Price& price, int size,
|
||||
onixs_ice::AggressorSide::Enum agside, const onixs_ice::DateTime& onixs_date, bool from_spread)
|
||||
{
|
||||
auto ts = utils::TimeStamp::now();
|
||||
PriceSize ps = pricesize_of_price_size(price, data->handle.security().ice_deal_denominator, size);
|
||||
PriceSize ps = pricesize_of_price_size(price, data->handle.security().ice_deal_denominator, size,data->handle.security());
|
||||
auto date = ll_of_timestamp(onixs_date);
|
||||
data->handle.add_trade(ts, ps, date, map_aggressor(agside), 0u, from_spread);
|
||||
}
|
||||
|
||||
@@ -185,6 +185,8 @@ void ICEListener::set_security_common(const Definition& def, FixedSecurity& fsec
|
||||
fsec.low_tick = fsec.high_tick = min_tick;
|
||||
fsec.price_break = 0.0;
|
||||
fsec.is_ice_lots = def.marketDesc.find("ICE Lots") != std::string::npos;
|
||||
// TODO
|
||||
fsec.ice_exchange_qty_mult = fsec.is_ice_lots ? 1 : 2500;
|
||||
fsec.ice_market_description(def.marketDesc);
|
||||
fsec.ice_cleared_alias(def.clearedAlias);
|
||||
fsec.ice_product_name(def.productName);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "lib/utils/helper_macros.h"
|
||||
#include "lib/md/ice/ICEUtils.h"
|
||||
#include "lib/md/coconut2.h"
|
||||
#include "lib/md/Shm/FixedSecurity.h"
|
||||
|
||||
#include "onixs.h"
|
||||
|
||||
@@ -14,7 +15,13 @@
|
||||
namespace bts {
|
||||
namespace md {
|
||||
namespace ice {
|
||||
|
||||
|
||||
|
||||
inline Size from_exchange_qty (Size qty, const bts::md::FixedSecurity& sec){
|
||||
Size qty_div = sec.ice_exchange_qty_mult;
|
||||
return qty/qty_div;
|
||||
}
|
||||
|
||||
template <typename OnixPrice>
|
||||
double double_of_price(const OnixPrice& price, int8_t denominator)
|
||||
{
|
||||
@@ -32,8 +39,10 @@ IntPrice convert_price(const OnixsPrice& price, int8_t denominator)
|
||||
}
|
||||
|
||||
template <typename OnixsPrice>
|
||||
inline PriceSize pricesize_of_price_size(const OnixsPrice& price, int8_t denominator, Size size)
|
||||
{
|
||||
inline PriceSize pricesize_of_price_size(const OnixsPrice& price, int8_t denominator, Size size,
|
||||
const bts::md::FixedSecurity& sec)
|
||||
{
|
||||
size = from_exchange_qty(size,sec);
|
||||
auto intpx = convert_price<OnixsPrice>(price, denominator);
|
||||
PriceSize result({intpx.mantissa(), (int8_t)(intpx.exponent())}, size);
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user