Merge branch 'SP-91-position-migration' of bitbucket.org:bluetradesys/spark into SP-91-position-migration
This commit is contained in:
commit
c60ada3c78
2 files changed
+21
-4
No files matched your search
@@ -23,6 +23,7 @@
|
||||
#include "lib/orderman/securities/MapSecurityDB.h"
|
||||
#include "lib/tracing/PerfLog.h"
|
||||
#include "lib/utils/PBUtils.h"
|
||||
#include "lib/api/service_helpers/PositionUtilities.h"
|
||||
#include <future>
|
||||
|
||||
namespace bts {
|
||||
@@ -261,12 +262,15 @@ make_pos_event(api::position::PositionUnit const &pu,
|
||||
securities::MapSecurityDB const &o) {
|
||||
auto sec = o.resolve(SecurityKey(pu.security_id()));
|
||||
if (sec) {
|
||||
uint32_t total_long_pos, total_short_pos;
|
||||
bts::position::PositionUtilities::total_position(pu,
|
||||
total_long_pos,
|
||||
total_short_pos);
|
||||
FilledPositionEvent ev{
|
||||
*sec, AccountID(pu.account_id()),
|
||||
Quantity(pu.sod().long_pos() + pu.day().long_pos() +
|
||||
pu.admin_sod().long_pos()),
|
||||
Quantity(pu.sod().short_pos() + pu.day().short_pos() +
|
||||
pu.admin_sod().short_pos())};
|
||||
Quantity(total_long_pos),
|
||||
Quantity(total_short_pos)
|
||||
};
|
||||
return {ev};
|
||||
} else
|
||||
return {};
|
||||
|
||||
@@ -94,6 +94,19 @@ const PositionUnit& PositionMap::on_fill (const Fill& f,
|
||||
"",
|
||||
is_add);
|
||||
break;
|
||||
case ManualFill::ADMIN_DAY:
|
||||
PositionUtilities::apply_fill(*(pu.mutable_admin_day()),
|
||||
mf.side(),
|
||||
mf.price(),
|
||||
mf.quantity(),
|
||||
"",
|
||||
is_add);
|
||||
PositionUtilities::apply_fill(*(pu.mutable_raw_day()),
|
||||
mf.side(),
|
||||
mf.price(),
|
||||
mf.quantity(),
|
||||
"",
|
||||
is_add);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user