diff --git a/IB-Tracker/src/ActiveTrades/ActiveTrades.cpp b/IB-Tracker/src/ActiveTrades/ActiveTrades.cpp index 37ab974e..e157c4de 100644 --- a/IB-Tracker/src/ActiveTrades/ActiveTrades.cpp +++ b/IB-Tracker/src/ActiveTrades/ActiveTrades.cpp @@ -171,6 +171,7 @@ void ActiveTrades_ShowActiveTrades(const bool bForceReload) // If tickerId already exists for our trade then use that one otherwise assign new tickerId. int next_ticker_id = (trade->tickerId > 0) ? trade->tickerId : tickerId++; + trade->tickerId = next_ticker_id; ListBoxData_OpenPosition(hListBox, trade, next_ticker_id); } } @@ -196,7 +197,8 @@ void ActiveTrades_ShowActiveTrades(const bool bForceReload) ListBoxData_NoTradesExistMessage(hListBox); ListBoxData_ResizeColumnWidths(hListBox, TableType::active_trades, -1); AfxRedrawWindow(hListBox); - TradeHistory_ShowTradesHistoryTable(nullptr); + auto t = std::make_shared(); + TradeHistory_ShowTradesHistoryTable(t); } diff --git a/IB-Tracker/src/Config/Config.h b/IB-Tracker/src/Config/Config.h index 705ad150..af92dd1e 100644 --- a/IB-Tracker/src/Config/Config.h +++ b/IB-Tracker/src/Config/Config.h @@ -26,7 +26,7 @@ SOFTWARE. #pragma once -constexpr std::wstring version = L"2.5.0"; +constexpr std::wstring version = L"2.5.1"; bool SaveConfig(); bool LoadConfig(); diff --git a/IB-Tracker/src/TradeHistory/TradeHistory.cpp b/IB-Tracker/src/TradeHistory/TradeHistory.cpp index 2cc76730..4f8cd841 100644 --- a/IB-Tracker/src/TradeHistory/TradeHistory.cpp +++ b/IB-Tracker/src/TradeHistory/TradeHistory.cpp @@ -51,7 +51,7 @@ void TradeHistory_OnSize(HWND hwnd, UINT state, int cx, int cy); // ======================================================================================== // Populate the History ListBox with the current active/open trades // ======================================================================================== -void TradeHistory_ShowTradesHistoryTable(const std::shared_ptr& trade) +void TradeHistory_ShowTradesHistoryTable(std::shared_ptr& trade) { HWND hListBox = GetDlgItem(HWND_TRADEHISTORY, IDC_HISTORY_LISTBOX); HWND hCustomVScrollBar = GetDlgItem(HWND_TRADEHISTORY, IDC_HISTORY_CUSTOMVSCROLLBAR); diff --git a/IB-Tracker/src/TradeHistory/TradeHistory.h b/IB-Tracker/src/TradeHistory/TradeHistory.h index fe5e269f..d99146c2 100644 --- a/IB-Tracker/src/TradeHistory/TradeHistory.h +++ b/IB-Tracker/src/TradeHistory/TradeHistory.h @@ -52,5 +52,5 @@ constexpr int HISTORY_LISTBOX_ROWHEIGHT = 20; constexpr int TICKER_TOTALS_LISTBOX_ROWHEIGHT = 16; constexpr int TRADEHISTORY_MARGIN = 24; -void TradeHistory_ShowTradesHistoryTable(const std::shared_ptr& trade); +void TradeHistory_ShowTradesHistoryTable(std::shared_ptr& trade); diff --git a/IB-Tracker/src/Utilities/ListBoxData.cpp b/IB-Tracker/src/Utilities/ListBoxData.cpp index c6b33c2c..010a07ff 100644 --- a/IB-Tracker/src/Utilities/ListBoxData.cpp +++ b/IB-Tracker/src/Utilities/ListBoxData.cpp @@ -479,7 +479,7 @@ void ListBoxData_TradeROI(HWND hListBox, const std::shared_ptr& trade, Ti // ======================================================================================== // Create the display data for an Open Position that displays in Trades & History tables. // ======================================================================================== -void ListBoxData_OpenPosition(HWND hListBox, const std::shared_ptr& trade, TickerId tickerId) +void ListBoxData_OpenPosition(HWND hListBox, std::shared_ptr& trade, TickerId tickerId) { ListBoxData* ld = new ListBoxData; diff --git a/IB-Tracker/src/Utilities/ListBoxData.h b/IB-Tracker/src/Utilities/ListBoxData.h index 969c3b9e..624955ae 100644 --- a/IB-Tracker/src/Utilities/ListBoxData.h +++ b/IB-Tracker/src/Utilities/ListBoxData.h @@ -87,7 +87,9 @@ class ListBoxData { if (tickId != -1) line_type = LineType::ticker_line; tickerId = tickId; trade = tradeptr; - if (trade != nullptr) trade->tickerId = tickerId; + if (trade != nullptr && line_type == LineType::ticker_line) { + trade->tickerId = tickerId; + } col[index].text = text; col[index].HAlignment = HAlignment; @@ -126,7 +128,7 @@ bool ListBoxData_ResizeColumnWidths(HWND hListBox, TableType table_type, int ind void ListBoxData_DestroyItemData(HWND hListBox); void ListBoxData_RequestMarketData(HWND hListBox); void ListBoxData_NoTradesExistMessage(HWND hListBox); -void ListBoxData_OpenPosition(HWND hListBox, const std::shared_ptr& trade, TickerId tickerId); +void ListBoxData_OpenPosition(HWND hListBox, std::shared_ptr& trade, TickerId tickerId); void ListBoxData_TradeROI(HWND hListBox, const std::shared_ptr& trade, TickerId tickerId); void ListBoxData_HistoryHeader( HWND hListBox, const std::shared_ptr& trade, const std::shared_ptr& trans);