backproof-sdk 0.1.1

Rust SDK to communicate with the backproof service
Documentation
syntax = "proto3";
package backproof;

// StrategyService
// A service about strategy configuration and runtime.
service StrategyService {
    // Before running the strategy you need to register it.
    rpc RegisterStrategy (RegisterStrategyRequest) returns (RegisterStrategyReply);

    // Run a stream of event to synchronyse the user strategy and our backend.
    rpc RunStrategy (stream RunStrategyInput) returns (stream RunStrategyOutput);
}

// Common
//
message Strategy {
    string id = 1;
    string name = 2;
    repeated string sessionIds = 3;
}

message Candle {
    double open = 1;
    double low = 2;
    double high = 3;
    double close = 4;

    double volume = 5;

    // time unit
    int32 tu = 6;
}

message Order {
    string symbol = 1;
    string quantity = 2;
    enum Side {
        LONG = 0;
        SHORT = 1;
    }
    Side side = 3;
}

// Register Strategy
//
message RegisterStrategyRequest {
    string apiKey = 1;
    string strategyName = 2;
}

message RegisterStrategyReply {
    enum Status {
        OK = 0;
        ERROR = 1;
    }
    Status status = 1;
    string message = 2;
    Strategy output = 3;
}

// Run Strategy
//
message RunStrategyInput {
    string strategyId = 1;

    oneof event {
        Order order = 3;
        StartSession startSession = 4;
        EndSession endSession = 5;
    }
}

message StartSession {
    string apiKey = 1;
    string sessionName = 2;
}

message EndSession {
    string apiKey = 1;
    string sessionName = 2;
}

message RunStrategyOutput {
    int32 uptime = 1;

    enum Status {
        WAITING_FOR_START = 0;
        RUNNING = 1;
        STOPPED = 2;
    }
    Status status = 2;

    string sessionName = 3;
    string sessionId = 4;

    oneof event {
        Candle candle = 5;
        EndSession endSession = 6;
    }
}