Symbol & data refactoring for Nautilus

This commit is contained in:
2026-04-01 00:59:13 -04:00
parent cd28e18e52
commit 93bc8a3a4f
55 changed files with 537 additions and 600 deletions

View File

@@ -31,10 +31,10 @@ message DataRequest {
}
message HistoricalParams {
// Start time (microseconds since epoch)
// Start time (nanoseconds since epoch)
uint64 start_time = 1;
// End time (microseconds since epoch)
// End time (nanoseconds since epoch)
uint64 end_time = 2;
// OHLC period in seconds (e.g., 60 = 1m, 300 = 5m, 3600 = 1h, 86400 = 1d)
@@ -115,13 +115,13 @@ message SubmitHistoricalRequest {
// Client-generated request ID for tracking
string request_id = 1;
// Market identifier (e.g., "BINANCE:BTC/USDT")
// Market identifier in Nautilus format (e.g., "BTC/USDT.BINANCE")
string ticker = 2;
// Start time (microseconds since epoch)
// Start time (nanoseconds since epoch)
uint64 start_time = 3;
// End time (microseconds since epoch)
// End time (nanoseconds since epoch)
uint64 end_time = 4;
// OHLC period in seconds (e.g., 60 = 1m, 300 = 5m, 3600 = 1h)
@@ -170,10 +170,10 @@ message HistoryReadyNotification {
// OHLC period in seconds
uint32 period_seconds = 3;
// Start time (microseconds since epoch)
// Start time (nanoseconds since epoch)
uint64 start_time = 4;
// End time (microseconds since epoch)
// End time (nanoseconds since epoch)
uint64 end_time = 5;
// Status of the data fetch
@@ -189,7 +189,7 @@ message HistoryReadyNotification {
// Number of records written
uint32 row_count = 12;
// Timestamp when data was written (microseconds since epoch)
// Timestamp when data was written (nanoseconds since epoch)
uint64 completed_at = 13;
enum NotificationStatus {
@@ -208,10 +208,10 @@ message OHLCRequest {
// Market identifier
string ticker = 2;
// Start time (microseconds since epoch)
// Start time (nanoseconds since epoch)
uint64 start_time = 3;
// End time (microseconds since epoch)
// End time (nanoseconds since epoch)
uint64 end_time = 4;
// OHLC period in seconds (e.g., 60 = 1m, 300 = 5m, 3600 = 1h)
@@ -290,7 +290,7 @@ message CEPTriggerEvent {
// Trigger ID that fired
string trigger_id = 1;
// Timestamp when trigger fired (microseconds since epoch)
// Timestamp when trigger fired (nanoseconds since epoch)
uint64 timestamp = 2;
// Schema information for the result rows

View File

@@ -4,19 +4,27 @@ option java_multiple_files = true;
option java_package = "com.dexorder.proto";
message Market {
// The prices and volumes must be adjusted by the rational denominator provided
// by the market metadata
string exchange_id = 2; // e.g., BINANCE
string market_id = 3; // e.g., BTC/USDT
string market_type = 4; // e.g., Spot
string description = 5; // e.g., Bitcoin/Tether on Binance
repeated string column_names = 6; // e.g., ['open', 'high', 'low', 'close', 'volume', 'taker_vol', 'maker_vol']
string base_asset = 9;
string quote_asset = 10;
uint64 earliest_time = 11;
uint64 tick_denom = 12; // denominator applied to all OHLC price data
uint64 base_denom = 13; // denominator applied to base asset units
uint64 quote_denom = 14; // denominator applied to quote asset units
string exchange_id = 2; // e.g., BINANCE
string market_id = 3; // e.g., BTC/USDT
string market_type = 4; // e.g., Spot, CryptoPerpetual
string description = 5; // e.g., Bitcoin/Tether on Binance
repeated string column_names = 6; // e.g., ['open', 'high', 'low', 'close', 'volume']
string base_asset = 9; // e.g., BTC
string quote_asset = 10; // e.g., USDT
uint64 earliest_time = 11; // nanoseconds since epoch
repeated uint32 supported_period_seconds = 15;
// Nautilus Instrument fields — used to construct Instrument objects in the sandbox bridge
uint32 price_precision = 16; // decimal places for prices (e.g., 2 for $0.01 resolution)
uint32 size_precision = 17; // decimal places for quantities
double tick_size = 18; // minimum price increment (e.g., 0.01)
double lot_size = 19; // minimum order size
double min_notional = 20; // minimum order value in quote currency
double margin_init = 21; // initial margin requirement (futures/perps only)
double margin_maint = 22; // maintenance margin (futures/perps only)
double maker_fee = 23; // maker fee rate (e.g., 0.001 = 0.1%)
double taker_fee = 24; // taker fee rate
double contract_multiplier = 25; // contract multiplier for derivatives (default 1.0)
}

View File

@@ -5,11 +5,11 @@ option java_package = "com.dexorder.proto";
// Single OHLC row
message OHLC {
// Timestamp in microseconds since epoch
// Timestamp in nanoseconds since epoch
uint64 timestamp = 1;
// The prices and volumes must be adjusted by the rational denominator provided
// by the market metadata. Optional to support null bars for periods with no trades.
// Prices are stored as doubles (Nautilus-aligned, no denominator needed).
// Optional to support null bars for periods with no trades.
optional int64 open = 2;
optional int64 high = 3;
optional int64 low = 4;
@@ -22,7 +22,7 @@ message OHLC {
optional int64 low_time = 11;
optional int64 close_time = 12;
optional int64 open_interest = 13;
string ticker = 14;
string ticker = 14; // Nautilus format: "BTC/USDT.BINANCE"
}
// Batch of OHLC rows with metadata for historical request tracking
@@ -49,7 +49,7 @@ message OHLCBatchMetadata {
// OHLC period in seconds
uint32 period_seconds = 4;
// Time range requested (microseconds since epoch)
// Time range requested (nanoseconds since epoch)
uint64 start_time = 5;
uint64 end_time = 6;

View File

@@ -7,19 +7,19 @@ message Tick {
// Unique identifier for the trade
string trade_id = 1;
// Market identifier (matches Market.market_id)
// Market identifier in Nautilus format: "BTC/USDT.BINANCE"
string ticker = 2;
// Timestamp in microseconds since epoch
// Timestamp in nanoseconds since epoch
uint64 timestamp = 3;
// Price (must be adjusted by tick_denom from Market metadata)
// Price as a scaled integer (divide by 10^price_precision from Market metadata)
int64 price = 4;
// Base asset amount (must be adjusted by base_denom from Market metadata)
// Base asset amount as a scaled integer (divide by 10^size_precision from Market metadata)
int64 amount = 5;
// Quote asset amount (must be adjusted by quote_denom from Market metadata)
// Quote asset amount as a scaled integer
int64 quote_amount = 6;
// Side: true = taker buy (market buy), false = taker sell (market sell)