syntax="proto3"; package bts.api.analytics; option csharp_namespace="bts.api.analytics"; import "lib/api/apioptions.proto"; import "lib/api/apicore.proto"; import "lib/domain_model/Security.proto"; // Each vol surface save will create one of these // Each entry is stored as a value in a ns, key, value tuple // where ns = volsurface__, key = save_time, // value = VolSurfaceEntry message VolSurfaceEntry{ uint64 save_time = 10 [(bts.api.key)=true]; int32 vs_id = 20; string vs_name = 30; bytes volsurface = 40; } // Tells which vs does an option symbol gets its theos (an option // symbol can belong to multiple vss') message VolSurfaceUsageEntry{ bts.api.Venue symbol_venue = 1; //unused string symbol_name = 2; //unused int32 vs_id = 10; SecurityTuple sec_tup = 20; } // message VolSurfaceUsageList{ int32 id = 10 [(bts.api.key)=true]; repeated VolSurfaceUsageEntry usage_list = 20; } message ArchivedSecurityTheo{ uint32 id = 10; double driver = 20; double vol = 30; double theo = 40; double delta = 50; } message ArchivedTheoList{ uint64 save_time = 10; // these are sec_tups that are part of this save repeated bts.api.SecurityTuple sec_tups = 20; repeated ArchivedSecurityTheo sec_theo = 30; } message ArchivedTheoRetrieval{ SecurityTuple sec_tup = 10; uint64 save_time = 20; } message AnalyticsServiceCreateReply { bool ok = 1; int32 new_id = 2; } enum DriverCalculationType{ DIRECT = 0; TIME_WEIGHTED_INTERP = 1; } message ExpirationParameterEntry{ int32 id = 10 [(bts.api.key)=true]; bts.api.SecurityType security_type = 20; string symbol = 30; bts.api.Expiration expiration = 40; bts.api.Venue exchange = 50; DriverCalculationType driver_calc = 55; bts.api.SecurityType driver_security_type = 60; string driver_symbol = 70; bts.api.Expiration driver_expiration = 80; bts.api.Venue driver_exchange = 90; bts.api.SecurityType deliverable_security_type = 100; string deliverable_symbol = 110; bts.api.Expiration deliverable_expiration = 120; bts.api.Venue deliverable_exchange = 130; bts.api.SecurityType roll_schedule_security_type = 140; string roll_schedule_symbol = 150; bts.api.Expiration roll_schedule_expiration = 160; bts.api.Venue roll_schedule_exchange = 170; double roll_target = 180; double riskless_rate = 190; double settlement_price = 200; double driver_addend = 210; double driver_factor = 220; bts.api.Expiration driver_translation_target = 230; double delta_beta = 240; double vega_beta = 250; } message ExpirationParameterEntryList{ int32 id = 10 [(bts.api.key)=true]; repeated ExpirationParameterEntry param_list = 20; } message IntWrapper{ int32 data = 1; } enum VolSurfaceGreeks { Vol = 0; Moneyness = 20; Theo = 30; Delta = 40; BSMDelta = 50; FlatVolDelta = 60; Vega = 70; BSMVega = 80; AdjustedVega = 90; Theta = 100; AdjustedTheta = 110; RollRho = 120; DiscountRho = 130; TimeValue = 140; Gamma = 150; BSMGamma = 160; OEV = 170; BSMOEV = 180; Vanna = 190; Volga = 200; Charm = 210; DVolDUnd = 220; // Vol²/DUnd² D2VolDUnd2 = 230; DPriceDRiskReversal = 240; DPriceDStrangle = 250; DPriceDPutTilt = 260; DPriceDCallTilt = 270; PNL = 280; ExpirationDelta = 290; } message Report{ enum ReportType { Slide = 0; Combo = 1; PnL = 2; } enum StrikeGrouping { RawStrike = 0; Delta = 1; StandardStrike = 2; } enum ReportCalculationMode { UserPrompted = 0; PositionOrTheoChange = 1; } int32 id = 10; int32 vs_id = 20; string report_type = 30; ReportType report_name = 40; string internal_account = 50; string risk_terms_name = 60; bts.api.SecurityType risk_terms_type = 70; string option_equivalence_name = 80; bts.api.SecurityType option_equivalence_type = 90; bts.api.SecurityTuple securities = 95; repeated double handles = 100; repeated double strike_buckets = 110; StrikeGrouping strike_grouping = 120; repeated VolSurfaceGreeks greeks = 130; bool slide_handles_in_percentage = 140; ReportCalculationMode calc_mode = 150; } service AnalyticsService { option (bts.api.service_description) = "Provides VolSurface creations and saves"; rpc get_new_volsurface_id(bts.api.VoidMessage) returns (AnalyticsServiceCreateReply); rpc save_volsurface(VolSurfaceEntry) returns (bts.api.ResultMessage); rpc delete_volsurface(IntWrapper) returns (bts.api.ResultMessage); rpc clean_up(IntWrapper) returns (bts.api.VoidMessage); rpc set_exp_parameters(ExpirationParameterEntryList) returns (bts.api.ResultMessage); rpc set_volsurface_usage_list(VolSurfaceUsageList) returns (bts.api.ResultMessage); rpc archive_theos(ArchivedTheoList) returns (bts.api.ResultMessage); // finds the archived_theo closest to this point rpc get_archived_theos(ArchivedTheoRetrieval) returns (ArchivedTheoList); // subscription rpc volsurfaces(bts.api.VoidMessage) returns (stream VolSurfaceEntry); rpc exp_parameters(bts.api.VoidMessage) returns (stream ExpirationParameterEntryList); rpc volsurface_usage(bts.api.VoidMessage) returns (stream VolSurfaceUsageList); // reports rpc get_new_report_id(bts.api.VoidMessage) returns (AnalyticsServiceCreateReply); rpc save_report(Report) returns (bts.api.ResultMessage); rpc delete_report(IntWrapper) returns (bts.api.ResultMessage); rpc reports(bts.api.VoidMessage) returns (stream Report); }