TT CORE SDK

Downloading Fills

Downloading Fills

For efficiency reasons, TT Core SDK does not hold fills in memory. If you need to access past fills, you:

  • Create a class that is derived from ttsdk::IFillDownloadCallbackHandlerPtr and defines your event handler. You must provide implementations for:
    • virtual void OnDownloadComplete(const DownloadResult code, HistoricalFillCollectionPtr orders, const char* message) = 0;
      • Callback fired when the fill download is completed
  • Call the DownloadFills() function passing your event handler instance variable and other query parameters.

The following code snippet demonstrates an example of this process.



class FillObserver : public ttsdk::IFillDownloadCallbackHandlerPtr
{
  public:
    	FillObserver() {}

    	virtual void OnDownloadComplete(const DownloadResult code,
                      HistoricalFillCollectionPtr fills, const char* message)
	    {
		          if (code == DownloadResult.SUCCESS)
              {
                    for (size_t i = 0; i < fills->GetCount(); i++)
                    {
                            FillPtr fill = fills->GetFill(i);
                            ExecutionReportPtr er = fill->GetExecutionReport();
                            std::cout << “Order ID = “ << er->GetOrderId()
                                  << “ Cumulative Fill Qty = “ << er->GetCumQty()
                                  << std::endl;
                    }
              }
              else
              {
                    std::cout << "Fill download request failed -- “ << message << std::endl;
              }
	    }
};

FillObserver fillObserver;

void foo()
{
        // …

        const uint64_t accountId = 12345;
        bool result = ttsdk::DownloadFills(fillObserver, accountId);

        // ...
}