Create Extension Modules using C++ Software Development Kit

A cross platform library written in C++17, integrated with Cmake3 build system for Windows and Linux operating system.The SDK enables developers to implement custom data filters, features engineering, trading strategies, data connectors and much more.

Modules code examples are available on STELGIC github Repository.
WINDOWS DEVELOPMENT ENVIRONMENT
  • Visual Studio 2022
  • Cmake 3.12.0 or above
  • Git 2.39 or above

git clone https://github.com/stelgic/platform.git stelgic
cd stelgic/samples/sources
mkdir build && build
cmake ..


* Navigate to stelgic/samples/sources/build and open qcraftor.sln with visual studio
*
Go to Solution Explorer -> CMakePredefinedTargets and right click on INSTALL -> Build

Note: If you installed the application in non default path please update samples/sources/CMakeLists.txt set(APP_DIR "/PATH_TO/Stelgic Fintech/Stelgic")

LINUX DEVELOPMENT ENVIRONMENT (COMING SOON)
  • GCC 10
  • Cmake 3.12.0 or above
  • Git 2.39 or above

Linux installer package will be available in near future. Our code base is cross platform.

Strategies - Signal Prediction module

Users can implement and backtest custom strategies by override the BaseStrategy class. In case of ML inference the base class provide virtual bool LoadTrainedML(...) method to be overridden to this purpose.
// include/qcraftor/BaseStrategy.h
#pragma once

#include <BaseStrategy.h>

namespace stelgic
{
class SimpleStrategy: public BaseStrategy
{
public:
    static constexpr const char* moduleName = "simplestrategy";

public:
    SimpleStrategy(const SimpleStrategy& other) = default;
    SimpleStrategy& operator=(const SimpleStrategy& other) = default;
    
public:
    SimpleStrategy() {};
    virtual ~SimpleStrategy(){ };
    
    bool ValidateInputs(const StrategyInputData& input) override;
    void Evaluate(const StrategyInputData& input) override;

protected:
    std::vector<Json::Value> PredictSignal(const StrategyInputData& data) override;
    virtual void InitStateMap() override;
};
}

Processors - Indicators & Features Engineering module

The data processing module implements technical indicators, data filtering, features engineering and more... A new processor can be added to the system by override the IDataProcessor interface class.
// include/qcraftor/IDataProcessor.h
#pragma once

#include <IDataProcessor.h>

using namespace stelgic;

/**
 * cache last computed values for each instrument 
 * to be use on next calculation
 */
struct RSI
{
    RSI() {}
    virtual ~RSI() {}
    RSI(size_t len, double initValue) { 
        upAvgs.resize(len, initValue); 
        downAvgs.resize(len, initValue); 
        prevRsis.resize(len, initValue); 
        prevPrices.resize(len, initValue); 
    }

    std::vector<double> upAvgs;
    std::vector<double> downAvgs;
    std::vector<double> prevRsis;
    std::vector<double> prevPrices;
};


/**
 * Implements RSI technical indicator processor interface
 */
class RsiProcessor : public IDataProcessor
{
public:
    using Tag = IndicTag<RSI>;
    static constexpr const char* moduleName = "rsi";

public:
    RsiProcessor() {}
    virtual ~RsiProcessor() {}

    virtual TaskArray Evaluate(
        StrategyInputData& dataRef, size_t aSize, IndicParams &data, 
        const double &errorVal, bool& allocate, std::atomic_bool& success) override;

    std::vector<std::string> const& GetOutNames() const override 
    {
        return outNames;
    }

    DataTag GetDataTag() override { return DataTags::OHLCV(); }

protected:
    std::vector<std::string> outNames = {"RSI"};
};


Metrics - Performance & Risk analytics module

A custom performance metrics and risk analytics can be implement using IMetrics  in conjunction with IKernelMetrics class. Multiple metrics kernels can be implement and registered into single module.
// include/qcraftor/IMetrics.h
#pragma once

#include <IMetrics.h>

namespace stelgic
{
class StandardMetrics: public IMetrics
{
public:
    static constexpr const char* moduleName = "standards";

public:
    StandardMetrics(const StandardMetrics& other) = default;
    StandardMetrics& operator=(const StandardMetrics& other) = default;

public:
    StandardMetrics() {}
    virtual ~StandardMetrics() {}

    bool IsInitialized() override;
    std::string GetName() override;
    const MetricsCollection::value_type::second_type& GetKernels() const override;
    const MetricsCollection::value_type::second_type& GetMissingKernels() const override;
    bool Init(const MetricsCollection::value_type::second_type& collection, 
            g3::LogWorker* logWorker, int verbosity) override;
    void Evaluate(MetricReferenceData& data) override;

private:
    void InitializeOutputs(const stelgic::MetricParams &metric);

private:
    MetricsCollection::value_type::second_type metrics;
    MetricsCollection::value_type::second_type missings;
    std::atomic<int> verbose = ATOMIC_FLAG_INIT; 
};
}