Compare commits

...
Author SHA1 Message Date
Kevin Darby 50e61604ba move default keycode exp to 12/31/2019 to fix unit tests 2019-09-30 11:53:44 -04:00
Kevin Darby 6bd23f106f Merged in fix_nan_pnl (pull request #361)
add temporary config to ignore nan day pnl to stop the loss limit from keeping traders out of market
2019-09-30 15:07:11 +00:00
Kevin Darby dfd8348724 add temporary config to ignore nan day pnl to stop the loss limit from keeping traders out of market 2019-09-30 11:03:03 -04:00
Kevin Darby da42e95754 fixed externals and docker 2019-09-25 10:59:58 -04:00
Kevin Darby a878a55ac1 moved externals 2019-09-25 10:00:20 -04:00
John Colvin 4305d560aa Merged in pnl-rounding-error (pull request #359)
RTM Pnl rounding error

Approved-by: Jake Norbut <jake.norbut@bluetradesys.com>
Approved-by: Eric Harding <eric.harding@bluetradesys.com>
2019-09-25 13:57:52 +00:00
John Colvin 055f0015e7 Update.naggle pr edit: 'TryPop' is an innappropriate name (just use 'Remove') 2019-09-24 17:28:06 -05:00
6 changed files with 29 additions and 11 deletions

No files matched your search

+4 -4
View File
@@ -100,7 +100,7 @@ namespace bts.api.core {
// Add
foreach (var v in next.added) {
var k = _key(v);
if (removed.TryPop(k, out var oldval)) {
if (removed.Remove(k, out var oldval)) {
changes.AddOrMerge(new Change<T>(oldval, v));
} else {
added[k] = v;
@@ -110,7 +110,7 @@ namespace bts.api.core {
// Change
foreach (var c in next.changes) {
var k = _key(c.Old);
if (!added.TryReplace(k, c.New))
if (!added.Replace(k, c.New))
changes.AddOrMerge(c);
}
@@ -162,10 +162,10 @@ namespace bts.api.core {
public bool Remove(TKey key) =>
_cache.Remove(key);
public bool TryPop(TKey key, out TValue value) =>
public bool Remove(TKey key, out TValue value) =>
_cache.TryGetValue(key, out value) && _cache.Remove(key);
public bool TryReplace(TKey key, TValue value) {
public bool Replace(TKey key, TValue value) {
if (_cache.ContainsKey(key)) {
_cache[key] = value;
return true;
+9 -5
View File
@@ -1,9 +1,13 @@
#nusers: 1
#allow concurrent : false
#expires: 2019-Sep-30 00:00:00 637053984000000000
#generation_time: 2019-Jun-18 18:25:44.333280 5248650809870720704
#allow concurrent : true
#expires: 2019-Dec-31 00:00:00 637133472000000000
#generation_time: 2019-Sep-30 15:52:10.434845 5248740573731736354
EncryptedKeyCode {
value {
keycode: "pgtv/OmievnpmNlgxTYuN801Hbetgu7ZGkHnlGWtK+DBrKSEgKxr5lGvCW1ld/jsztkWhKHDh0iediMDjrPm4+C5qmXlt4JJlAFvKolMN8HVC59m82fECvakcqKq28WSEjf6/DuPJNP1ZwxjcmKouxx1LZ15VlNkECtNrC9pkCnifazbfQZGV3kD08zMEyw/RPmOaVLFFeav8lwI5UpcjPYBIK1rJowXdGSvm1CJViwG5Z2JbdHR39QbKjVx112d5VbVtBq9nO3i0FEKvobjN/Gzcz/5x4TgQtEShKsbmgEN+MBVL3AItQlcFzZvE/05JLmfACUFmk5Eu0a3DlLs3A=="
keycode: "fVZlub92ulkXME+uZSyO9+WmyAXYKD735Qzxxfdj4G+SqEDTuwfNxOZVPS3TCFQqWPDmgjKTbbvfqIrGe3icxkVObUcUoS7lBXRXFrSvzOfs9eTz9RqHRvquDidnOzKxmSXsxV2bMb21UqBCJFeTzb4Q6Agp8EtjXJRc57UMVVygvdXg528S3ocBIq1V4W5NYraFn5WpqrTuBhpYbnsZAHi77s/EEwUT+6la3J2OHPtbiQnB6JFb0zsExMuzE4gwp79ojuQ5pnV2DXBZFNwxYvFyBUU/ac6oU89saZ/ay1DbOjz76TNqnNFewZvzdXZl3y6+X1eblX2streH2pn7gg=="
}
}
}
+4
View File
@@ -58,3 +58,7 @@ message EnsureOnScreenWithWorkAreaRect {
// Should verify that the code works with every monitor arrangement before enabling by default.
optional bool enabled = 1 [default = false];
}
message IgnoreNansInDayPnL {
optional bool enabled = 1 [default = true];
}
@@ -4,6 +4,7 @@
#include "lib/os/os.h"
#include "PositionServicePNLHelper.h"
#include "lib/config/protos/cme_reference_data.pb.h"
#include "lib/config/protos/toggles.pb.h"
#include "lib/config/config.h"
#include "lib/utils/PBUtils.h"
@@ -217,6 +218,15 @@ double PositionServicePNLHelper::_compute_day_pnl (
(md - u.pos().day_long_avg_price()),
short_pnl = std::abs(u.pos().day_short_pos()) * u.cash_value() *
(u.pos().day_short_avg_price() - md);
if(config::get<config::toggles::IgnoreNansInDayPnL>().enabled())
{
if(bts::os::is_nan(long_pnl))
long_pnl = 0.0;
if(bts::os::is_nan(short_pnl))
short_pnl = 0.0;
}
pnl = long_pnl + short_pnl;
break;
}