442 lines
42 KiB
TypeScript
442 lines
42 KiB
TypeScript
/**
|
|
* Fair probability mapping table — shared by the p-series strategies
|
|
*
|
|
* Data structure: FAIR_PROB_TABLES is Record<MarketKey, RawData>
|
|
* - key shaped like "btc-5m", "eth-5m", "btc-15m"
|
|
* - each market maintains its own table (the fair-probability distribution differs completely across markets)
|
|
*
|
|
* Adding a new market table:
|
|
* 1. Run the backtest: `python3 backtest-data/analyze.py --symbol <sym> --period <p>`
|
|
* 2. Add the generated RawData array to FAIR_PROB_TABLES["sym-period"]
|
|
* 3. Restart the service
|
|
*
|
|
* A market without a table makes getFairProb() return null, and p-series strategies automatically no-op
|
|
* (combined with the strategy's supportedMarkets allowlist, double protection)
|
|
*/
|
|
|
|
type RawData = Array<[number, string, number]>; // [diff bucket, rem bin, upPct median]
|
|
|
|
// BTC 5m table (based on 37 days of ~2.5M tick statistics; step=2, updated 2026-05-09)
|
|
// How to update: rerun the backtest tool to regenerate and replace the data below
|
|
const BTC_5M: RawData = [
|
|
[-140,"0-30",1],[-140,"30-60",1],[-140,"60-120",2],[-140,"120-180",6],[-140,"180-240",10],[-140,"240-300",16],
|
|
[-138,"0-30",0],[-138,"30-60",0],[-138,"60-120",2],[-138,"120-180",5],[-138,"180-240",14],[-138,"240-300",15],
|
|
[-136,"0-30",0],[-136,"30-60",0],[-136,"60-120",6],[-136,"120-180",10],[-136,"180-240",11],[-136,"240-300",14],
|
|
[-134,"0-30",0],[-134,"30-60",1],[-134,"60-120",12],[-134,"120-180",8],[-134,"180-240",10],[-134,"240-300",16],
|
|
[-132,"0-30",0],[-132,"30-60",2],[-132,"60-120",5],[-132,"120-180",12],[-132,"180-240",22],[-132,"240-300",29],
|
|
[-130,"0-30",0],[-130,"30-60",1],[-130,"60-120",7],[-130,"120-180",9],[-130,"180-240",19],[-130,"240-300",10],
|
|
[-128,"0-30",1],[-128,"30-60",7],[-128,"60-120",8],[-128,"120-180",16],[-128,"180-240",14],[-128,"240-300",34],
|
|
[-126,"0-30",0],[-126,"30-60",1],[-126,"60-120",3],[-126,"120-180",12],[-126,"180-240",12],[-126,"240-300",41],
|
|
[-124,"0-30",0],[-124,"30-60",8],[-124,"60-120",4],[-124,"120-180",9],[-124,"180-240",16],[-124,"240-300",12],
|
|
[-122,"0-30",0],[-122,"30-60",0],[-122,"60-120",1],[-122,"120-180",10],[-122,"180-240",15],[-122,"240-300",14],
|
|
[-120,"0-30",1],[-120,"30-60",5],[-120,"60-120",2],[-120,"120-180",6],[-120,"180-240",19],[-120,"240-300",18],
|
|
[-118,"0-30",0],[-118,"30-60",1],[-118,"60-120",1],[-118,"120-180",10],[-118,"180-240",13],[-118,"240-300",25],
|
|
[-116,"0-30",1],[-116,"30-60",6],[-116,"60-120",4],[-116,"120-180",6],[-116,"180-240",17],[-116,"240-300",22],
|
|
[-114,"0-30",0],[-114,"30-60",1],[-114,"60-120",5],[-114,"120-180",7],[-114,"180-240",9],[-114,"240-300",25],
|
|
[-112,"0-30",1],[-112,"30-60",3],[-112,"60-120",3],[-112,"120-180",5],[-112,"180-240",10],[-112,"240-300",14],
|
|
[-110,"0-30",0],[-110,"30-60",0],[-110,"60-120",2],[-110,"120-180",5],[-110,"180-240",10],[-110,"240-300",25],
|
|
[-108,"0-30",0],[-108,"30-60",4],[-108,"60-120",3],[-108,"120-180",6],[-108,"180-240",10],[-108,"240-300",31],
|
|
[-106,"0-30",0],[-106,"30-60",0],[-106,"60-120",5],[-106,"120-180",7],[-106,"180-240",8],[-106,"240-300",16],
|
|
[-104,"0-30",0],[-104,"30-60",1],[-104,"60-120",3],[-104,"120-180",5],[-104,"180-240",14],[-104,"240-300",18],
|
|
[-102,"0-30",0],[-102,"30-60",1],[-102,"60-120",5],[-102,"120-180",6],[-102,"180-240",10],[-102,"240-300",3],
|
|
[-100,"0-30",0],[-100,"30-60",1],[-100,"60-120",4],[-100,"120-180",6],[-100,"180-240",15],[-100,"240-300",17],
|
|
[-98,"0-30",0],[-98,"30-60",1],[-98,"60-120",4],[-98,"120-180",7],[-98,"180-240",10],[-98,"240-300",24],
|
|
[-96,"0-30",0],[-96,"30-60",4],[-96,"60-120",6],[-96,"120-180",10],[-96,"180-240",7],[-96,"240-300",21],
|
|
[-94,"0-30",0],[-94,"30-60",0],[-94,"60-120",2],[-94,"120-180",5],[-94,"180-240",12],[-94,"240-300",29],
|
|
[-92,"0-30",0],[-92,"30-60",2],[-92,"60-120",2],[-92,"120-180",11],[-92,"180-240",15],[-92,"240-300",24],
|
|
[-90,"0-30",5],[-90,"30-60",9],[-90,"60-120",3],[-90,"120-180",7],[-90,"180-240",14],[-90,"240-300",20],
|
|
[-88,"0-30",2],[-88,"30-60",2],[-88,"60-120",9],[-88,"120-180",9],[-88,"180-240",12],[-88,"240-300",18],
|
|
[-86,"0-30",0],[-86,"30-60",1],[-86,"60-120",6],[-86,"120-180",5],[-86,"180-240",20],[-86,"240-300",16],
|
|
[-84,"0-30",1],[-84,"30-60",4],[-84,"60-120",8],[-84,"120-180",11],[-84,"180-240",25],[-84,"240-300",23],
|
|
[-82,"0-30",3],[-82,"30-60",5],[-82,"60-120",7],[-82,"120-180",11],[-82,"180-240",16],[-82,"240-300",18],
|
|
[-80,"0-30",3],[-80,"30-60",5],[-80,"60-120",6],[-80,"120-180",11],[-80,"180-240",22],[-80,"240-300",20],
|
|
[-78,"0-30",3],[-78,"30-60",3],[-78,"60-120",6],[-78,"120-180",10],[-78,"180-240",18],[-78,"240-300",28],
|
|
[-76,"0-30",1],[-76,"30-60",4],[-76,"60-120",6],[-76,"120-180",13],[-76,"180-240",24],[-76,"240-300",39],
|
|
[-74,"0-30",3],[-74,"30-60",4],[-74,"60-120",6],[-74,"120-180",12],[-74,"180-240",16],[-74,"240-300",37],
|
|
[-72,"0-30",0],[-72,"30-60",3],[-72,"60-120",10],[-72,"120-180",13],[-72,"180-240",20],[-72,"240-300",31],
|
|
[-70,"0-30",2],[-70,"30-60",5],[-70,"60-120",6],[-70,"120-180",11],[-70,"180-240",22],[-70,"240-300",27],
|
|
[-68,"0-30",3],[-68,"30-60",5],[-68,"60-120",12],[-68,"120-180",21],[-68,"180-240",19],[-68,"240-300",25],
|
|
[-66,"0-30",5],[-66,"30-60",10],[-66,"60-120",9],[-66,"120-180",13],[-66,"180-240",20],[-66,"240-300",30],
|
|
[-64,"0-30",4],[-64,"30-60",7],[-64,"60-120",13],[-64,"120-180",14],[-64,"180-240",19],[-64,"240-300",35],
|
|
[-62,"0-30",3],[-62,"30-60",8],[-62,"60-120",9],[-62,"120-180",13],[-62,"180-240",21],[-62,"240-300",30],
|
|
[-60,"0-30",3],[-60,"30-60",5],[-60,"60-120",12],[-60,"120-180",13],[-60,"180-240",22],[-60,"240-300",33],
|
|
[-58,"0-30",1],[-58,"30-60",7],[-58,"60-120",12],[-58,"120-180",19],[-58,"180-240",18],[-58,"240-300",25],
|
|
[-56,"0-30",3],[-56,"30-60",6],[-56,"60-120",10],[-56,"120-180",19],[-56,"180-240",22],[-56,"240-300",36],
|
|
[-54,"0-30",3],[-54,"30-60",8],[-54,"60-120",8],[-54,"120-180",21],[-54,"180-240",25],[-54,"240-300",32],
|
|
[-52,"0-30",8],[-52,"30-60",7],[-52,"60-120",12],[-52,"120-180",21],[-52,"180-240",24],[-52,"240-300",32],
|
|
[-50,"0-30",3],[-50,"30-60",5],[-50,"60-120",13],[-50,"120-180",19],[-50,"180-240",21],[-50,"240-300",31],
|
|
[-48,"0-30",11],[-48,"30-60",12],[-48,"60-120",13],[-48,"120-180",19],[-48,"180-240",25],[-48,"240-300",36],
|
|
[-46,"0-30",4],[-46,"30-60",7],[-46,"60-120",13],[-46,"120-180",17],[-46,"180-240",25],[-46,"240-300",31],
|
|
[-44,"0-30",5],[-44,"30-60",8],[-44,"60-120",16],[-44,"120-180",21],[-44,"180-240",23],[-44,"240-300",33],
|
|
[-42,"0-30",8],[-42,"30-60",12],[-42,"60-120",18],[-42,"120-180",19],[-42,"180-240",23],[-42,"240-300",31],
|
|
[-40,"0-30",7],[-40,"30-60",14],[-40,"60-120",17],[-40,"120-180",23],[-40,"180-240",25],[-40,"240-300",32],
|
|
[-38,"0-30",10],[-38,"30-60",15],[-38,"60-120",13],[-38,"120-180",22],[-38,"180-240",29],[-38,"240-300",34],
|
|
[-36,"0-30",9],[-36,"30-60",13],[-36,"60-120",18],[-36,"120-180",23],[-36,"180-240",28],[-36,"240-300",36],
|
|
[-34,"0-30",7],[-34,"30-60",10],[-34,"60-120",18],[-34,"120-180",21],[-34,"180-240",23],[-34,"240-300",36],
|
|
[-32,"0-30",9],[-32,"30-60",13],[-32,"60-120",18],[-32,"120-180",24],[-32,"180-240",30],[-32,"240-300",34],
|
|
[-30,"0-30",11],[-30,"30-60",15],[-30,"60-120",21],[-30,"120-180",25],[-30,"180-240",31],[-30,"240-300",40],
|
|
[-28,"0-30",13],[-28,"30-60",18],[-28,"60-120",26],[-28,"120-180",27],[-28,"180-240",33],[-28,"240-300",36],
|
|
[-26,"0-30",11],[-26,"30-60",17],[-26,"60-120",26],[-26,"120-180",28],[-26,"180-240",32],[-26,"240-300",36],
|
|
[-24,"0-30",13],[-24,"30-60",21],[-24,"60-120",27],[-24,"120-180",30],[-24,"180-240",36],[-24,"240-300",39],
|
|
[-22,"0-30",14],[-22,"30-60",27],[-22,"60-120",24],[-22,"120-180",31],[-22,"180-240",40],[-22,"240-300",38],
|
|
[-20,"0-30",15],[-20,"30-60",23],[-20,"60-120",28],[-20,"120-180",33],[-20,"180-240",35],[-20,"240-300",41],
|
|
[-18,"0-30",14],[-18,"30-60",23],[-18,"60-120",28],[-18,"120-180",33],[-18,"180-240",40],[-18,"240-300",40],
|
|
[-16,"0-30",16],[-16,"30-60",25],[-16,"60-120",29],[-16,"120-180",38],[-16,"180-240",40],[-16,"240-300",43],
|
|
[-14,"0-30",16],[-14,"30-60",20],[-14,"60-120",35],[-14,"120-180",35],[-14,"180-240",38],[-14,"240-300",40],
|
|
[-12,"0-30",21],[-12,"30-60",31],[-12,"60-120",35],[-12,"120-180",36],[-12,"180-240",37],[-12,"240-300",44],
|
|
[-10,"0-30",22],[-10,"30-60",29],[-10,"60-120",35],[-10,"120-180",42],[-10,"180-240",39],[-10,"240-300",43],
|
|
[-8,"0-30",23],[-8,"30-60",32],[-8,"60-120",38],[-8,"120-180",39],[-8,"180-240",42],[-8,"240-300",47],
|
|
[-6,"0-30",31],[-6,"30-60",41],[-6,"60-120",38],[-6,"120-180",41],[-6,"180-240",45],[-6,"240-300",46],
|
|
[-4,"0-30",32],[-4,"30-60",36],[-4,"60-120",39],[-4,"120-180",42],[-4,"180-240",47],[-4,"240-300",46],
|
|
[-2,"0-30",49],[-2,"30-60",50],[-2,"60-120",54],[-2,"120-180",57],[-2,"180-240",53],[-2,"240-300",52],
|
|
[0,"0-30",51],[0,"30-60",53],[0,"60-120",54],[0,"120-180",53],[0,"180-240",54],[0,"240-300",53],
|
|
[2,"0-30",58],[2,"30-60",60],[2,"60-120",59],[2,"120-180",55],[2,"180-240",55],[2,"240-300",55],
|
|
[4,"0-30",66],[4,"30-60",61],[4,"60-120",56],[4,"120-180",53],[4,"180-240",54],[4,"240-300",54],
|
|
[6,"0-30",73],[6,"30-60",65],[6,"60-120",62],[6,"120-180",58],[6,"180-240",57],[6,"240-300",55],
|
|
[8,"0-30",76],[8,"30-60",69],[8,"60-120",63],[8,"120-180",62],[8,"180-240",58],[8,"240-300",56],
|
|
[10,"0-30",80],[10,"30-60",67],[10,"60-120",71],[10,"120-180",63],[10,"180-240",60],[10,"240-300",61],
|
|
[12,"0-30",81],[12,"30-60",69],[12,"60-120",65],[12,"120-180",59],[12,"180-240",60],[12,"240-300",60],
|
|
[14,"0-30",81],[14,"30-60",74],[14,"60-120",69],[14,"120-180",62],[14,"180-240",63],[14,"240-300",62],
|
|
[16,"0-30",86],[16,"30-60",71],[16,"60-120",65],[16,"120-180",65],[16,"180-240",68],[16,"240-300",62],
|
|
[18,"0-30",89],[18,"30-60",79],[18,"60-120",71],[18,"120-180",66],[18,"180-240",62],[18,"240-300",65],
|
|
[20,"0-30",91],[20,"30-60",84],[20,"60-120",71],[20,"120-180",71],[20,"180-240",65],[20,"240-300",60],
|
|
[22,"0-30",86],[22,"30-60",86],[22,"60-120",77],[22,"120-180",71],[22,"180-240",73],[22,"240-300",67],
|
|
[24,"0-30",91],[24,"30-60",81],[24,"60-120",77],[24,"120-180",74],[24,"180-240",68],[24,"240-300",64],
|
|
[26,"0-30",91],[26,"30-60",89],[26,"60-120",80],[26,"120-180",74],[26,"180-240",69],[26,"240-300",68],
|
|
[28,"0-30",89],[28,"30-60",85],[28,"60-120",82],[28,"120-180",77],[28,"180-240",68],[28,"240-300",66],
|
|
[30,"0-30",91],[30,"30-60",87],[30,"60-120",80],[30,"120-180",77],[30,"180-240",74],[30,"240-300",71],
|
|
[32,"0-30",92],[32,"30-60",82],[32,"60-120",79],[32,"120-180",79],[32,"180-240",74],[32,"240-300",70],
|
|
[34,"0-30",88],[34,"30-60",86],[34,"60-120",86],[34,"120-180",83],[34,"180-240",69],[34,"240-300",75],
|
|
[36,"0-30",94],[36,"30-60",88],[36,"60-120",86],[36,"120-180",80],[36,"180-240",72],[36,"240-300",69],
|
|
[38,"0-30",95],[38,"30-60",86],[38,"60-120",85],[38,"120-180",83],[38,"180-240",73],[38,"240-300",75],
|
|
[40,"0-30",97],[40,"30-60",94],[40,"60-120",88],[40,"120-180",81],[40,"180-240",80],[40,"240-300",74],
|
|
[42,"0-30",97],[42,"30-60",89],[42,"60-120",85],[42,"120-180",78],[42,"180-240",74],[42,"240-300",73],
|
|
[44,"0-30",98],[44,"30-60",92],[44,"60-120",87],[44,"120-180",78],[44,"180-240",75],[44,"240-300",72],
|
|
[46,"0-30",97],[46,"30-60",92],[46,"60-120",89],[46,"120-180",77],[46,"180-240",77],[46,"240-300",73],
|
|
[48,"0-30",98],[48,"30-60",94],[48,"60-120",90],[48,"120-180",80],[48,"180-240",76],[48,"240-300",70],
|
|
[50,"0-30",99],[50,"30-60",95],[50,"60-120",85],[50,"120-180",84],[50,"180-240",76],[50,"240-300",73],
|
|
[52,"0-30",99],[52,"30-60",95],[52,"60-120",91],[52,"120-180",85],[52,"180-240",83],[52,"240-300",77],
|
|
[54,"0-30",99],[54,"30-60",96],[54,"60-120",89],[54,"120-180",81],[54,"180-240",79],[54,"240-300",69],
|
|
[56,"0-30",97],[56,"30-60",95],[56,"60-120",92],[56,"120-180",85],[56,"180-240",82],[56,"240-300",76],
|
|
[58,"0-30",98],[58,"30-60",95],[58,"60-120",89],[58,"120-180",85],[58,"180-240",78],[58,"240-300",74],
|
|
[60,"0-30",98],[60,"30-60",96],[60,"60-120",90],[60,"120-180",90],[60,"180-240",82],[60,"240-300",77],
|
|
[62,"0-30",99],[62,"30-60",95],[62,"60-120",90],[62,"120-180",90],[62,"180-240",79],[62,"240-300",80],
|
|
[64,"0-30",99],[64,"30-60",98],[64,"60-120",95],[64,"120-180",86],[64,"180-240",83],[64,"240-300",73],
|
|
[66,"0-30",100],[66,"30-60",96],[66,"60-120",94],[66,"120-180",86],[66,"180-240",85],[66,"240-300",70],
|
|
[68,"0-30",100],[68,"30-60",98],[68,"60-120",92],[68,"120-180",89],[68,"180-240",84],[68,"240-300",75],
|
|
[70,"0-30",99],[70,"30-60",98],[70,"60-120",91],[70,"120-180",87],[70,"180-240",84],[70,"240-300",79],
|
|
[72,"0-30",99],[72,"30-60",98],[72,"60-120",97],[72,"120-180",91],[72,"180-240",84],[72,"240-300",71],
|
|
[74,"0-30",99],[74,"30-60",99],[74,"60-120",91],[74,"120-180",87],[74,"180-240",81],[74,"240-300",79],
|
|
[76,"0-30",99],[76,"30-60",98],[76,"60-120",96],[76,"120-180",90],[76,"180-240",81],[76,"240-300",82],
|
|
[78,"0-30",100],[78,"30-60",100],[78,"60-120",96],[78,"120-180",91],[78,"180-240",82],[78,"240-300",79],
|
|
[80,"0-30",100],[80,"30-60",99],[80,"60-120",95],[80,"120-180",90],[80,"180-240",85],[80,"240-300",87],
|
|
[82,"0-30",100],[82,"30-60",99],[82,"60-120",94],[82,"120-180",92],[82,"180-240",90],[82,"240-300",81],
|
|
[84,"0-30",98],[84,"30-60",100],[84,"60-120",96],[84,"120-180",91],[84,"180-240",91],[84,"240-300",80],
|
|
[86,"0-30",100],[86,"30-60",100],[86,"60-120",98],[86,"120-180",92],[86,"180-240",88],[86,"240-300",86],
|
|
[88,"0-30",100],[88,"30-60",100],[88,"60-120",98],[88,"120-180",89],[88,"180-240",86],[88,"240-300",76],
|
|
[90,"0-30",100],[90,"30-60",100],[90,"60-120",96],[90,"120-180",92],[90,"180-240",88],[90,"240-300",77],
|
|
[92,"0-30",100],[92,"30-60",100],[92,"60-120",98],[92,"120-180",94],[92,"180-240",87],[92,"240-300",89],
|
|
[94,"0-30",100],[94,"30-60",99],[94,"60-120",98],[94,"120-180",90],[94,"180-240",87],[94,"240-300",86],
|
|
[96,"0-30",100],[96,"30-60",99],[96,"60-120",98],[96,"120-180",95],[96,"180-240",91],[96,"240-300",84],
|
|
];
|
|
|
|
// ETH 5m table (based on 13 days of ~940K tick statistics; step=0.1)
|
|
// Bucket design: step 0.1, range ±7 (covers 99% of the diff distribution)
|
|
const ETH_5M: RawData = [
|
|
[-7.0,"0-30",18],[-7.0,"30-60",31],[-7.0,"60-120",2],[-7.0,"120-180",9],[-7.0,"180-240",25],[-7.0,"240-300",59],
|
|
[-6.9,"0-30",100],[-6.9,"30-60",33],[-6.9,"60-120",5],[-6.9,"120-180",35],[-6.9,"180-240",27],[-6.9,"240-300",0],
|
|
[-6.8,"0-30",100],[-6.8,"30-60",100],[-6.8,"60-120",31],[-6.8,"120-180",4],[-6.8,"180-240",11],[-6.8,"240-300",20],
|
|
[-6.7,"0-30",26],[-6.7,"30-60",0],[-6.7,"60-120",26],[-6.7,"120-180",43],[-6.7,"180-240",40],[-6.7,"240-300",25],
|
|
[-6.6,"0-30",100],[-6.6,"30-60",100],[-6.6,"60-120",9],[-6.6,"120-180",17],[-6.6,"180-240",20],[-6.6,"240-300",0],
|
|
[-6.5,"0-30",15],[-6.5,"30-60",0],[-6.5,"60-120",0],[-6.5,"120-180",12],[-6.5,"180-240",43],[-6.5,"240-300",20],
|
|
[-6.4,"0-30",28],[-6.4,"30-60",100],[-6.4,"60-120",4],[-6.4,"120-180",23],[-6.4,"180-240",4],[-6.4,"240-300",10],
|
|
[-6.3,"0-30",100],[-6.3,"30-60",40],[-6.3,"60-120",24],[-6.3,"120-180",0],[-6.3,"180-240",17],[-6.3,"240-300",60],
|
|
[-6.2,"0-30",100],[-6.2,"30-60",60],[-6.2,"60-120",18],[-6.2,"120-180",14],[-6.2,"180-240",0],[-6.2,"240-300",11],
|
|
[-6.1,"0-30",100],[-6.1,"30-60",33],[-6.1,"60-120",8],[-6.1,"120-180",26],[-6.1,"180-240",10],[-6.1,"240-300",22],
|
|
[-6.0,"0-30",11],[-6.0,"30-60",0],[-6.0,"60-120",30],[-6.0,"120-180",22],[-6.0,"180-240",7],[-6.0,"240-300",0],
|
|
[-5.9,"0-30",21],[-5.9,"30-60",50],[-5.9,"60-120",14],[-5.9,"120-180",20],[-5.9,"180-240",10],[-5.9,"240-300",12],
|
|
[-5.8,"0-30",19],[-5.8,"30-60",33],[-5.8,"60-120",31],[-5.8,"120-180",19],[-5.8,"180-240",5],[-5.8,"240-300",8],
|
|
[-5.7,"0-30",7],[-5.7,"30-60",0],[-5.7,"60-120",0],[-5.7,"120-180",15],[-5.7,"180-240",12],[-5.7,"240-300",8],
|
|
[-5.6,"0-30",9],[-5.6,"30-60",0],[-5.6,"60-120",6],[-5.6,"120-180",9],[-5.6,"180-240",24],[-5.6,"240-300",8],
|
|
[-5.5,"0-30",0],[-5.5,"30-60",0],[-5.5,"60-120",1],[-5.5,"120-180",5],[-5.5,"180-240",19],[-5.5,"240-300",12],
|
|
[-5.4,"0-30",27],[-5.4,"30-60",0],[-5.4,"60-120",5],[-5.4,"120-180",13],[-5.4,"180-240",7],[-5.4,"240-300",18],
|
|
[-5.3,"0-30",100],[-5.3,"30-60",0],[-5.3,"60-120",1],[-5.3,"120-180",17],[-5.3,"180-240",20],[-5.3,"240-300",19],
|
|
[-5.2,"0-30",64],[-5.2,"30-60",0],[-5.2,"60-120",9],[-5.2,"120-180",8],[-5.2,"180-240",19],[-5.2,"240-300",25],
|
|
[-5.1,"0-30",100],[-5.1,"30-60",0],[-5.1,"60-120",4],[-5.1,"120-180",7],[-5.1,"180-240",10],[-5.1,"240-300",33],
|
|
[-5.0,"0-30",0],[-5.0,"30-60",6],[-5.0,"60-120",2],[-5.0,"120-180",15],[-5.0,"180-240",7],[-5.0,"240-300",41],
|
|
[-4.9,"0-30",25],[-4.9,"30-60",22],[-4.9,"60-120",6],[-4.9,"120-180",9],[-4.9,"180-240",9],[-4.9,"240-300",26],
|
|
[-4.8,"0-30",0],[-4.8,"30-60",0],[-4.8,"60-120",3],[-4.8,"120-180",7],[-4.8,"180-240",12],[-4.8,"240-300",27],
|
|
[-4.7,"0-30",25],[-4.7,"30-60",17],[-4.7,"60-120",4],[-4.7,"120-180",14],[-4.7,"180-240",27],[-4.7,"240-300",27],
|
|
[-4.6,"0-30",11],[-4.6,"30-60",20],[-4.6,"60-120",10],[-4.6,"120-180",4],[-4.6,"180-240",23],[-4.6,"240-300",47],
|
|
[-4.5,"0-30",75],[-4.5,"30-60",5],[-4.5,"60-120",17],[-4.5,"120-180",7],[-4.5,"180-240",11],[-4.5,"240-300",19],
|
|
[-4.4,"0-30",0],[-4.4,"30-60",0],[-4.4,"60-120",12],[-4.4,"120-180",12],[-4.4,"180-240",22],[-4.4,"240-300",56],
|
|
[-4.3,"0-30",86],[-4.3,"30-60",22],[-4.3,"60-120",18],[-4.3,"120-180",10],[-4.3,"180-240",15],[-4.3,"240-300",37],
|
|
[-4.2,"0-30",0],[-4.2,"30-60",21],[-4.2,"60-120",8],[-4.2,"120-180",16],[-4.2,"180-240",15],[-4.2,"240-300",32],
|
|
[-4.1,"0-30",100],[-4.1,"30-60",8],[-4.1,"60-120",8],[-4.1,"120-180",15],[-4.1,"180-240",19],[-4.1,"240-300",38],
|
|
[-4.0,"0-30",56],[-4.0,"30-60",20],[-4.0,"60-120",7],[-4.0,"120-180",12],[-4.0,"180-240",14],[-4.0,"240-300",48],
|
|
[-3.9,"0-30",5],[-3.9,"30-60",13],[-3.9,"60-120",9],[-3.9,"120-180",7],[-3.9,"180-240",14],[-3.9,"240-300",37],
|
|
[-3.8,"0-30",41],[-3.8,"30-60",10],[-3.8,"60-120",7],[-3.8,"120-180",14],[-3.8,"180-240",12],[-3.8,"240-300",45],
|
|
[-3.7,"0-30",67],[-3.7,"30-60",17],[-3.7,"60-120",6],[-3.7,"120-180",8],[-3.7,"180-240",15],[-3.7,"240-300",40],
|
|
[-3.6,"0-30",18],[-3.6,"30-60",1],[-3.6,"60-120",7],[-3.6,"120-180",12],[-3.6,"180-240",8],[-3.6,"240-300",30],
|
|
[-3.5,"0-30",14],[-3.5,"30-60",20],[-3.5,"60-120",3],[-3.5,"120-180",18],[-3.5,"180-240",15],[-3.5,"240-300",26],
|
|
[-3.4,"0-30",44],[-3.4,"30-60",3],[-3.4,"60-120",6],[-3.4,"120-180",14],[-3.4,"180-240",15],[-3.4,"240-300",26],
|
|
[-3.3,"0-30",13],[-3.3,"30-60",11],[-3.3,"60-120",8],[-3.3,"120-180",14],[-3.3,"180-240",11],[-3.3,"240-300",27],
|
|
[-3.2,"0-30",13],[-3.2,"30-60",0],[-3.2,"60-120",9],[-3.2,"120-180",12],[-3.2,"180-240",16],[-3.2,"240-300",26],
|
|
[-3.1,"0-30",31],[-3.1,"30-60",1],[-3.1,"60-120",7],[-3.1,"120-180",13],[-3.1,"180-240",18],[-3.1,"240-300",32],
|
|
[-3.0,"0-30",30],[-3.0,"30-60",11],[-3.0,"60-120",13],[-3.0,"120-180",8],[-3.0,"180-240",23],[-3.0,"240-300",29],
|
|
[-2.9,"0-30",7],[-2.9,"30-60",6],[-2.9,"60-120",8],[-2.9,"120-180",10],[-2.9,"180-240",12],[-2.9,"240-300",22],
|
|
[-2.8,"0-30",19],[-2.8,"30-60",6],[-2.8,"60-120",10],[-2.8,"120-180",21],[-2.8,"180-240",23],[-2.8,"240-300",35],
|
|
[-2.7,"0-30",29],[-2.7,"30-60",16],[-2.7,"60-120",11],[-2.7,"120-180",20],[-2.7,"180-240",17],[-2.7,"240-300",46],
|
|
[-2.6,"0-30",21],[-2.6,"30-60",19],[-2.6,"60-120",11],[-2.6,"120-180",14],[-2.6,"180-240",15],[-2.6,"240-300",37],
|
|
[-2.5,"0-30",5],[-2.5,"30-60",5],[-2.5,"60-120",15],[-2.5,"120-180",19],[-2.5,"180-240",18],[-2.5,"240-300",35],
|
|
[-2.4,"0-30",16],[-2.4,"30-60",16],[-2.4,"60-120",12],[-2.4,"120-180",15],[-2.4,"180-240",29],[-2.4,"240-300",39],
|
|
[-2.3,"0-30",6],[-2.3,"30-60",14],[-2.3,"60-120",14],[-2.3,"120-180",13],[-2.3,"180-240",21],[-2.3,"240-300",42],
|
|
[-2.2,"0-30",30],[-2.2,"30-60",11],[-2.2,"60-120",23],[-2.2,"120-180",25],[-2.2,"180-240",24],[-2.2,"240-300",32],
|
|
[-2.1,"0-30",8],[-2.1,"30-60",9],[-2.1,"60-120",14],[-2.1,"120-180",21],[-2.1,"180-240",25],[-2.1,"240-300",37],
|
|
[-2.0,"0-30",12],[-2.0,"30-60",9],[-2.0,"60-120",20],[-2.0,"120-180",23],[-2.0,"180-240",28],[-2.0,"240-300",29],
|
|
[-1.9,"0-30",6],[-1.9,"30-60",13],[-1.9,"60-120",25],[-1.9,"120-180",23],[-1.9,"180-240",30],[-1.9,"240-300",32],
|
|
[-1.8,"0-30",15],[-1.8,"30-60",16],[-1.8,"60-120",18],[-1.8,"120-180",26],[-1.8,"180-240",27],[-1.8,"240-300",36],
|
|
[-1.7,"0-30",18],[-1.7,"30-60",13],[-1.7,"60-120",22],[-1.7,"120-180",27],[-1.7,"180-240",34],[-1.7,"240-300",30],
|
|
[-1.6,"0-30",12],[-1.6,"30-60",14],[-1.6,"60-120",23],[-1.6,"120-180",26],[-1.6,"180-240",28],[-1.6,"240-300",35],
|
|
[-1.5,"0-30",19],[-1.5,"30-60",16],[-1.5,"60-120",21],[-1.5,"120-180",30],[-1.5,"180-240",30],[-1.5,"240-300",38],
|
|
[-1.4,"0-30",24],[-1.4,"30-60",23],[-1.4,"60-120",20],[-1.4,"120-180",25],[-1.4,"180-240",29],[-1.4,"240-300",34],
|
|
[-1.3,"0-30",21],[-1.3,"30-60",17],[-1.3,"60-120",25],[-1.3,"120-180",29],[-1.3,"180-240",35],[-1.3,"240-300",44],
|
|
[-1.2,"0-30",21],[-1.2,"30-60",18],[-1.2,"60-120",24],[-1.2,"120-180",23],[-1.2,"180-240",36],[-1.2,"240-300",39],
|
|
[-1.1,"0-30",16],[-1.1,"30-60",18],[-1.1,"60-120",21],[-1.1,"120-180",31],[-1.1,"180-240",42],[-1.1,"240-300",42],
|
|
[-1.0,"0-30",16],[-1.0,"30-60",22],[-1.0,"60-120",24],[-1.0,"120-180",32],[-1.0,"180-240",37],[-1.0,"240-300",41],
|
|
[-0.9,"0-30",15],[-0.9,"30-60",20],[-0.9,"60-120",29],[-0.9,"120-180",36],[-0.9,"180-240",40],[-0.9,"240-300",45],
|
|
[-0.8,"0-30",19],[-0.8,"30-60",21],[-0.8,"60-120",31],[-0.8,"120-180",33],[-0.8,"180-240",41],[-0.8,"240-300",43],
|
|
[-0.7,"0-30",20],[-0.7,"30-60",27],[-0.7,"60-120",36],[-0.7,"120-180",38],[-0.7,"180-240",42],[-0.7,"240-300",46],
|
|
[-0.6,"0-30",15],[-0.6,"30-60",25],[-0.6,"60-120",36],[-0.6,"120-180",40],[-0.6,"180-240",41],[-0.6,"240-300",46],
|
|
[-0.5,"0-30",21],[-0.5,"30-60",27],[-0.5,"60-120",38],[-0.5,"120-180",40],[-0.5,"180-240",45],[-0.5,"240-300",45],
|
|
[-0.4,"0-30",27],[-0.4,"30-60",38],[-0.4,"60-120",41],[-0.4,"120-180",42],[-0.4,"180-240",39],[-0.4,"240-300",45],
|
|
[-0.3,"0-30",30],[-0.3,"30-60",38],[-0.3,"60-120",43],[-0.3,"120-180",46],[-0.3,"180-240",49],[-0.3,"240-300",47],
|
|
[-0.2,"0-30",36],[-0.2,"30-60",47],[-0.2,"60-120",48],[-0.2,"120-180",47],[-0.2,"180-240",48],[-0.2,"240-300",52],
|
|
[-0.1,"0-30",47],[-0.1,"30-60",47],[-0.1,"60-120",49],[-0.1,"120-180",52],[-0.1,"180-240",54],[-0.1,"240-300",55],
|
|
[0.0,"0-30",56],[0.0,"30-60",54],[0.0,"60-120",55],[0.0,"120-180",56],[0.0,"180-240",56],[0.0,"240-300",56],
|
|
[0.1,"0-30",71],[0.1,"30-60",63],[0.1,"60-120",59],[0.1,"120-180",60],[0.1,"180-240",60],[0.1,"240-300",57],
|
|
[0.2,"0-30",73],[0.2,"30-60",74],[0.2,"60-120",65],[0.2,"120-180",66],[0.2,"180-240",61],[0.2,"240-300",57],
|
|
[0.3,"0-30",88],[0.3,"30-60",75],[0.3,"60-120",66],[0.3,"120-180",68],[0.3,"180-240",64],[0.3,"240-300",58],
|
|
[0.4,"0-30",87],[0.4,"30-60",75],[0.4,"60-120",72],[0.4,"120-180",67],[0.4,"180-240",62],[0.4,"240-300",61],
|
|
[0.5,"0-30",90],[0.5,"30-60",76],[0.5,"60-120",70],[0.5,"120-180",65],[0.5,"180-240",69],[0.5,"240-300",59],
|
|
[0.6,"0-30",87],[0.6,"30-60",83],[0.6,"60-120",77],[0.6,"120-180",70],[0.6,"180-240",67],[0.6,"240-300",64],
|
|
[0.7,"0-30",88],[0.7,"30-60",81],[0.7,"60-120",78],[0.7,"120-180",75],[0.7,"180-240",68],[0.7,"240-300",64],
|
|
[0.8,"0-30",94],[0.8,"30-60",86],[0.8,"60-120",80],[0.8,"120-180",73],[0.8,"180-240",71],[0.8,"240-300",64],
|
|
[0.9,"0-30",93],[0.9,"30-60",81],[0.9,"60-120",82],[0.9,"120-180",77],[0.9,"180-240",70],[0.9,"240-300",67],
|
|
[1.0,"0-30",94],[1.0,"30-60",88],[1.0,"60-120",84],[1.0,"120-180",77],[1.0,"180-240",72],[1.0,"240-300",64],
|
|
[1.1,"0-30",93],[1.1,"30-60",94],[1.1,"60-120",82],[1.1,"120-180",78],[1.1,"180-240",72],[1.1,"240-300",68],
|
|
[1.2,"0-30",96],[1.2,"30-60",90],[1.2,"60-120",78],[1.2,"120-180",82],[1.2,"180-240",71],[1.2,"240-300",68],
|
|
[1.3,"0-30",99],[1.3,"30-60",94],[1.3,"60-120",85],[1.3,"120-180",78],[1.3,"180-240",74],[1.3,"240-300",67],
|
|
[1.4,"0-30",97],[1.4,"30-60",92],[1.4,"60-120",86],[1.4,"120-180",80],[1.4,"180-240",73],[1.4,"240-300",74],
|
|
[1.5,"0-30",99],[1.5,"30-60",98],[1.5,"60-120",91],[1.5,"120-180",81],[1.5,"180-240",77],[1.5,"240-300",74],
|
|
[1.6,"0-30",99],[1.6,"30-60",96],[1.6,"60-120",87],[1.6,"120-180",81],[1.6,"180-240",76],[1.6,"240-300",69],
|
|
[1.7,"0-30",99],[1.7,"30-60",96],[1.7,"60-120",92],[1.7,"120-180",82],[1.7,"180-240",75],[1.7,"240-300",74],
|
|
[1.8,"0-30",97],[1.8,"30-60",97],[1.8,"60-120",93],[1.8,"120-180",80],[1.8,"180-240",79],[1.8,"240-300",76],
|
|
[1.9,"0-30",99],[1.9,"30-60",97],[1.9,"60-120",89],[1.9,"120-180",81],[1.9,"180-240",76],[1.9,"240-300",75],
|
|
[2.0,"0-30",95],[2.0,"30-60",93],[2.0,"60-120",93],[2.0,"120-180",82],[2.0,"180-240",73],[2.0,"240-300",77],
|
|
[2.1,"0-30",91],[2.1,"30-60",93],[2.1,"60-120",95],[2.1,"120-180",84],[2.1,"180-240",85],[2.1,"240-300",75],
|
|
[2.2,"0-30",99],[2.2,"30-60",96],[2.2,"60-120",93],[2.2,"120-180",83],[2.2,"180-240",79],[2.2,"240-300",82],
|
|
[2.3,"0-30",96],[2.3,"30-60",95],[2.3,"60-120",87],[2.3,"120-180",89],[2.3,"180-240",81],[2.3,"240-300",72],
|
|
[2.4,"0-30",97],[2.4,"30-60",93],[2.4,"60-120",91],[2.4,"120-180",84],[2.4,"180-240",84],[2.4,"240-300",79],
|
|
[2.5,"0-30",100],[2.5,"30-60",95],[2.5,"60-120",92],[2.5,"120-180",84],[2.5,"180-240",84],[2.5,"240-300",82],
|
|
[2.6,"0-30",100],[2.6,"30-60",96],[2.6,"60-120",93],[2.6,"120-180",87],[2.6,"180-240",83],[2.6,"240-300",73],
|
|
[2.7,"0-30",99],[2.7,"30-60",97],[2.7,"60-120",98],[2.7,"120-180",89],[2.7,"180-240",84],[2.7,"240-300",72],
|
|
[2.8,"0-30",99],[2.8,"30-60",98],[2.8,"60-120",98],[2.8,"120-180",94],[2.8,"180-240",82],[2.8,"240-300",81],
|
|
[2.9,"0-30",100],[2.9,"30-60",100],[2.9,"60-120",98],[2.9,"120-180",92],[2.9,"180-240",84],[2.9,"240-300",84],
|
|
[3.0,"0-30",100],[3.0,"30-60",98],[3.0,"60-120",96],[3.0,"120-180",95],[3.0,"180-240",87],[3.0,"240-300",83],
|
|
[3.1,"0-30",96],[3.1,"30-60",95],[3.1,"60-120",96],[3.1,"120-180",94],[3.1,"180-240",89],[3.1,"240-300",85],
|
|
[3.2,"0-30",97],[3.2,"30-60",99],[3.2,"60-120",87],[3.2,"120-180",93],[3.2,"180-240",89],[3.2,"240-300",85],
|
|
[3.3,"0-30",97],[3.3,"30-60",93],[3.3,"60-120",95],[3.3,"120-180",96],[3.3,"180-240",86],[3.3,"240-300",85],
|
|
[3.4,"0-30",98],[3.4,"30-60",96],[3.4,"60-120",95],[3.4,"120-180",97],[3.4,"180-240",93],[3.4,"240-300",90],
|
|
[3.5,"0-30",100],[3.5,"30-60",100],[3.5,"60-120",99],[3.5,"120-180",92],[3.5,"180-240",87],[3.5,"240-300",95],
|
|
[3.6,"0-30",100],[3.6,"30-60",100],[3.6,"60-120",96],[3.6,"120-180",90],[3.6,"180-240",89],[3.6,"240-300",90],
|
|
[3.7,"0-30",100],[3.7,"30-60",99],[3.7,"60-120",97],[3.7,"120-180",94],[3.7,"180-240",88],[3.7,"240-300",86],
|
|
[3.8,"0-30",98],[3.8,"30-60",99],[3.8,"60-120",97],[3.8,"120-180",87],[3.8,"180-240",89],[3.8,"240-300",90],
|
|
[3.9,"0-30",98],[3.9,"30-60",97],[3.9,"60-120",96],[3.9,"120-180",95],[3.9,"180-240",86],[3.9,"240-300",95],
|
|
[4.0,"0-30",95],[4.0,"30-60",94],[4.0,"60-120",99],[4.0,"120-180",88],[4.0,"180-240",83],[4.0,"240-300",85],
|
|
[4.1,"0-30",90],[4.1,"30-60",94],[4.1,"60-120",93],[4.1,"120-180",93],[4.1,"180-240",75],[4.1,"240-300",59],
|
|
[4.2,"0-30",99],[4.2,"30-60",99],[4.2,"60-120",94],[4.2,"120-180",95],[4.2,"180-240",90],[4.2,"240-300",73],
|
|
[4.3,"0-30",96],[4.3,"30-60",98],[4.3,"60-120",94],[4.3,"120-180",95],[4.3,"180-240",95],[4.3,"240-300",79],
|
|
[4.4,"0-30",95],[4.4,"30-60",99],[4.4,"60-120",94],[4.4,"120-180",91],[4.4,"180-240",97],[4.4,"240-300",79],
|
|
[4.5,"0-30",97],[4.5,"30-60",97],[4.5,"60-120",99],[4.5,"120-180",98],[4.5,"180-240",90],[4.5,"240-300",83],
|
|
[4.6,"0-30",95],[4.6,"30-60",95],[4.6,"60-120",97],[4.6,"120-180",94],[4.6,"180-240",87],[4.6,"240-300",74],
|
|
[4.7,"0-30",99],[4.7,"30-60",98],[4.7,"60-120",94],[4.7,"120-180",94],[4.7,"180-240",92],[4.7,"240-300",72],
|
|
[4.8,"0-30",100],[4.8,"30-60",100],[4.8,"60-120",98],[4.8,"120-180",91],[4.8,"180-240",90],[4.8,"240-300",96],
|
|
[4.9,"0-30",96],[4.9,"30-60",100],[4.9,"60-120",94],[4.9,"120-180",93],[4.9,"180-240",82],[4.9,"240-300",100],
|
|
[5.0,"0-30",92],[5.0,"30-60",100],[5.0,"60-120",98],[5.0,"120-180",94],[5.0,"180-240",94],[5.0,"240-300",74],
|
|
[5.1,"0-30",100],[5.1,"30-60",97],[5.1,"60-120",99],[5.1,"120-180",81],[5.1,"180-240",79],[5.1,"240-300",55],
|
|
[5.2,"0-30",100],[5.2,"30-60",98],[5.2,"60-120",95],[5.2,"120-180",89],[5.2,"180-240",84],[5.2,"240-300",77],
|
|
[5.3,"0-30",100],[5.3,"30-60",97],[5.3,"60-120",86],[5.3,"120-180",94],[5.3,"180-240",95],[5.3,"240-300",81],
|
|
[5.4,"0-30",100],[5.4,"30-60",96],[5.4,"60-120",80],[5.4,"120-180",98],[5.4,"180-240",89],[5.4,"240-300",100],
|
|
[5.5,"0-30",100],[5.5,"30-60",98],[5.5,"60-120",93],[5.5,"120-180",99],[5.5,"180-240",87],[5.5,"240-300",91],
|
|
[5.6,"0-30",83],[5.6,"30-60",94],[5.6,"60-120",98],[5.6,"120-180",98],[5.6,"180-240",97],[5.6,"240-300",100],
|
|
[5.7,"0-30",100],[5.7,"30-60",95],[5.7,"60-120",98],[5.7,"120-180",100],[5.7,"180-240",100],[5.7,"240-300",86],
|
|
[5.8,"0-30",98],[5.8,"30-60",89],[5.8,"60-120",99],[5.8,"120-180",98],[5.8,"180-240",100],[5.8,"240-300",79],
|
|
[5.9,"0-30",100],[5.9,"30-60",88],[5.9,"60-120",98],[5.9,"120-180",100],[5.9,"180-240",100],[5.9,"240-300",88],
|
|
[6.0,"0-30",96],[6.0,"30-60",89],[6.0,"60-120",96],[6.0,"120-180",90],[6.0,"180-240",98],[6.0,"240-300",89],
|
|
[6.1,"0-30",98],[6.1,"30-60",97],[6.1,"60-120",97],[6.1,"120-180",93],[6.1,"180-240",100],[6.1,"240-300",92],
|
|
[6.2,"0-30",99],[6.2,"30-60",92],[6.2,"60-120",91],[6.2,"120-180",90],[6.2,"180-240",99],[6.2,"240-300",86],
|
|
[6.3,"0-30",100],[6.3,"30-60",90],[6.3,"60-120",94],[6.3,"120-180",100],[6.3,"180-240",100],[6.3,"240-300",94],
|
|
[6.4,"0-30",91],[6.4,"30-60",98],[6.4,"60-120",97],[6.4,"120-180",93],[6.4,"180-240",96],[6.4,"240-300",80],
|
|
[6.5,"0-30",95],[6.5,"30-60",99],[6.5,"60-120",93],[6.5,"120-180",98],[6.5,"180-240",96],[6.5,"240-300",88],
|
|
[6.6,"0-30",99],[6.6,"30-60",99],[6.6,"60-120",98],[6.6,"120-180",100],[6.6,"180-240",100],[6.6,"240-300",92],
|
|
[6.7,"0-30",95],[6.7,"30-60",98],[6.7,"60-120",97],[6.7,"120-180",100],[6.7,"180-240",100],[6.7,"240-300",55],
|
|
[6.8,"0-30",96],[6.8,"30-60",100],[6.8,"60-120",100],[6.8,"120-180",98],[6.8,"180-240",92],[6.8,"240-300",100],
|
|
[6.9,"0-30",95],[6.9,"30-60",97],[6.9,"60-120",100],[6.9,"120-180",100],[6.9,"180-240",100],[6.9,"240-300",100],
|
|
[7.0,"0-30",98],[7.0,"30-60",98],[7.0,"60-120",100],[7.0,"120-180",99],[7.0,"180-240",97],[7.0,"240-300",81],
|
|
];
|
|
|
|
// SOL 5m table (based on 13 days of ~950K tick statistics; step=0.01)
|
|
// Bucket design: step 0.01, range ±0.4 (covers 99% of the diff distribution)
|
|
const SOL_5M: RawData = [
|
|
[-0.4,"0-30",100],[-0.4,"30-60",0],[-0.4,"60-120",0],[-0.4,"120-180",7],[-0.4,"180-240",22],[-0.4,"240-300",0],
|
|
[-0.39,"0-30",100],[-0.39,"30-60",30],[-0.39,"60-120",0],[-0.39,"120-180",0],[-0.39,"180-240",50],[-0.39,"240-300",0],
|
|
[-0.38,"0-30",100],[-0.38,"30-60",51],[-0.38,"60-120",0],[-0.38,"120-180",17],[-0.38,"180-240",71],[-0.38,"240-300",71],
|
|
[-0.37,"0-30",37],[-0.37,"30-60",37],[-0.37,"60-120",0],[-0.37,"120-180",21],[-0.37,"180-240",43],[-0.37,"240-300",87],
|
|
[-0.36,"0-30",100],[-0.36,"30-60",41],[-0.36,"60-120",0],[-0.36,"120-180",0],[-0.36,"180-240",30],[-0.36,"240-300",75],
|
|
[-0.35,"0-30",100],[-0.35,"30-60",100],[-0.35,"60-120",8],[-0.35,"120-180",21],[-0.35,"180-240",59],[-0.35,"240-300",83],
|
|
[-0.34,"0-30",88],[-0.34,"30-60",100],[-0.34,"60-120",0],[-0.34,"120-180",28],[-0.34,"180-240",16],[-0.34,"240-300",60],
|
|
[-0.33,"0-30",50],[-0.33,"30-60",67],[-0.33,"60-120",2],[-0.33,"120-180",34],[-0.33,"180-240",12],[-0.33,"240-300",11],
|
|
[-0.32,"0-30",17],[-0.32,"30-60",38],[-0.32,"60-120",2],[-0.32,"120-180",12],[-0.32,"180-240",17],[-0.32,"240-300",43],
|
|
[-0.31,"0-30",38],[-0.31,"30-60",61],[-0.31,"60-120",2],[-0.31,"120-180",19],[-0.31,"180-240",43],[-0.31,"240-300",100],
|
|
[-0.3,"0-30",33],[-0.3,"30-60",20],[-0.3,"60-120",2],[-0.3,"120-180",12],[-0.3,"180-240",32],[-0.3,"240-300",75],
|
|
[-0.29,"0-30",0],[-0.29,"30-60",18],[-0.29,"60-120",14],[-0.29,"120-180",12],[-0.29,"180-240",36],[-0.29,"240-300",17],
|
|
[-0.28,"0-30",50],[-0.28,"30-60",6],[-0.28,"60-120",23],[-0.28,"120-180",17],[-0.28,"180-240",41],[-0.28,"240-300",11],
|
|
[-0.27,"0-30",23],[-0.27,"30-60",0],[-0.27,"60-120",26],[-0.27,"120-180",21],[-0.27,"180-240",31],[-0.27,"240-300",10],
|
|
[-0.26,"0-30",0],[-0.26,"30-60",0],[-0.26,"60-120",11],[-0.26,"120-180",18],[-0.26,"180-240",30],[-0.26,"240-300",9],
|
|
[-0.25,"0-30",0],[-0.25,"30-60",0],[-0.25,"60-120",16],[-0.25,"120-180",16],[-0.25,"180-240",27],[-0.25,"240-300",31],
|
|
[-0.24,"0-30",0],[-0.24,"30-60",4],[-0.24,"60-120",19],[-0.24,"120-180",19],[-0.24,"180-240",16],[-0.24,"240-300",29],
|
|
[-0.23,"0-30",0],[-0.23,"30-60",0],[-0.23,"60-120",16],[-0.23,"120-180",14],[-0.23,"180-240",18],[-0.23,"240-300",18],
|
|
[-0.22,"0-30",30],[-0.22,"30-60",0],[-0.22,"60-120",9],[-0.22,"120-180",14],[-0.22,"180-240",22],[-0.22,"240-300",27],
|
|
[-0.21,"0-30",32],[-0.21,"30-60",31],[-0.21,"60-120",14],[-0.21,"120-180",14],[-0.21,"180-240",17],[-0.21,"240-300",38],
|
|
[-0.2,"0-30",31],[-0.2,"30-60",34],[-0.2,"60-120",8],[-0.2,"120-180",9],[-0.2,"180-240",10],[-0.2,"240-300",61],
|
|
[-0.19,"0-30",23],[-0.19,"30-60",10],[-0.19,"60-120",5],[-0.19,"120-180",8],[-0.19,"180-240",15],[-0.19,"240-300",49],
|
|
[-0.18,"0-30",12],[-0.18,"30-60",23],[-0.18,"60-120",4],[-0.18,"120-180",8],[-0.18,"180-240",14],[-0.18,"240-300",50],
|
|
[-0.17,"0-30",25],[-0.17,"30-60",1],[-0.17,"60-120",7],[-0.17,"120-180",8],[-0.17,"180-240",9],[-0.17,"240-300",39],
|
|
[-0.16,"0-30",13],[-0.16,"30-60",0],[-0.16,"60-120",3],[-0.16,"120-180",7],[-0.16,"180-240",15],[-0.16,"240-300",40],
|
|
[-0.15,"0-30",16],[-0.15,"30-60",2],[-0.15,"60-120",8],[-0.15,"120-180",7],[-0.15,"180-240",18],[-0.15,"240-300",33],
|
|
[-0.14,"0-30",14],[-0.14,"30-60",6],[-0.14,"60-120",12],[-0.14,"120-180",11],[-0.14,"180-240",17],[-0.14,"240-300",30],
|
|
[-0.13,"0-30",14],[-0.13,"30-60",12],[-0.13,"60-120",8],[-0.13,"120-180",17],[-0.13,"180-240",19],[-0.13,"240-300",24],
|
|
[-0.12,"0-30",16],[-0.12,"30-60",13],[-0.12,"60-120",9],[-0.12,"120-180",16],[-0.12,"180-240",26],[-0.12,"240-300",25],
|
|
[-0.11,"0-30",19],[-0.11,"30-60",8],[-0.11,"60-120",13],[-0.11,"120-180",23],[-0.11,"180-240",25],[-0.11,"240-300",29],
|
|
[-0.1,"0-30",18],[-0.1,"30-60",14],[-0.1,"60-120",13],[-0.1,"120-180",26],[-0.1,"180-240",25],[-0.1,"240-300",29],
|
|
[-0.09,"0-30",19],[-0.09,"30-60",15],[-0.09,"60-120",15],[-0.09,"120-180",27],[-0.09,"180-240",27],[-0.09,"240-300",23],
|
|
[-0.08,"0-30",21],[-0.08,"30-60",11],[-0.08,"60-120",20],[-0.08,"120-180",26],[-0.08,"180-240",27],[-0.08,"240-300",30],
|
|
[-0.07,"0-30",21],[-0.07,"30-60",19],[-0.07,"60-120",24],[-0.07,"120-180",27],[-0.07,"180-240",30],[-0.07,"240-300",35],
|
|
[-0.06,"0-30",21],[-0.06,"30-60",25],[-0.06,"60-120",27],[-0.06,"120-180",30],[-0.06,"180-240",34],[-0.06,"240-300",39],
|
|
[-0.05,"0-30",20],[-0.05,"30-60",20],[-0.05,"60-120",27],[-0.05,"120-180",29],[-0.05,"180-240",33],[-0.05,"240-300",38],
|
|
[-0.04,"0-30",22],[-0.04,"30-60",22],[-0.04,"60-120",30],[-0.04,"120-180",36],[-0.04,"180-240",39],[-0.04,"240-300",43],
|
|
[-0.03,"0-30",23],[-0.03,"30-60",28],[-0.03,"60-120",34],[-0.03,"120-180",41],[-0.03,"180-240",47],[-0.03,"240-300",48],
|
|
[-0.02,"0-30",29],[-0.02,"30-60",35],[-0.02,"60-120",39],[-0.02,"120-180",44],[-0.02,"180-240",48],[-0.02,"240-300",51],
|
|
[-0.01,"0-30",38],[-0.01,"30-60",46],[-0.01,"60-120",48],[-0.01,"120-180",51],[-0.01,"180-240",53],[-0.01,"240-300",56],
|
|
[0.0,"0-30",58],[0.0,"30-60",56],[0.0,"60-120",59],[0.0,"120-180",57],[0.0,"180-240",57],[0.0,"240-300",57],
|
|
[0.01,"0-30",74],[0.01,"30-60",69],[0.01,"60-120",67],[0.01,"120-180",65],[0.01,"180-240",63],[0.01,"240-300",59],
|
|
[0.02,"0-30",85],[0.02,"30-60",79],[0.02,"60-120",75],[0.02,"120-180",68],[0.02,"180-240",67],[0.02,"240-300",64],
|
|
[0.03,"0-30",91],[0.03,"30-60",85],[0.03,"60-120",79],[0.03,"120-180",75],[0.03,"180-240",70],[0.03,"240-300",67],
|
|
[0.04,"0-30",95],[0.04,"30-60",91],[0.04,"60-120",86],[0.04,"120-180",79],[0.04,"180-240",71],[0.04,"240-300",69],
|
|
[0.05,"0-30",96],[0.05,"30-60",90],[0.05,"60-120",86],[0.05,"120-180",79],[0.05,"180-240",74],[0.05,"240-300",70],
|
|
[0.06,"0-30",98],[0.06,"30-60",94],[0.06,"60-120",86],[0.06,"120-180",80],[0.06,"180-240",77],[0.06,"240-300",72],
|
|
[0.07,"0-30",96],[0.07,"30-60",93],[0.07,"60-120",89],[0.07,"120-180",82],[0.07,"180-240",79],[0.07,"240-300",74],
|
|
[0.08,"0-30",97],[0.08,"30-60",95],[0.08,"60-120",90],[0.08,"120-180",84],[0.08,"180-240",77],[0.08,"240-300",75],
|
|
[0.09,"0-30",97],[0.09,"30-60",93],[0.09,"60-120",92],[0.09,"120-180",88],[0.09,"180-240",79],[0.09,"240-300",76],
|
|
[0.1,"0-30",98],[0.1,"30-60",95],[0.1,"60-120",92],[0.1,"120-180",90],[0.1,"180-240",80],[0.1,"240-300",82],
|
|
[0.11,"0-30",98],[0.11,"30-60",97],[0.11,"60-120",94],[0.11,"120-180",89],[0.11,"180-240",85],[0.11,"240-300",87],
|
|
[0.12,"0-30",99],[0.12,"30-60",98],[0.12,"60-120",95],[0.12,"120-180",91],[0.12,"180-240",82],[0.12,"240-300",82],
|
|
[0.13,"0-30",99],[0.13,"30-60",96],[0.13,"60-120",98],[0.13,"120-180",89],[0.13,"180-240",87],[0.13,"240-300",89],
|
|
[0.14,"0-30",97],[0.14,"30-60",97],[0.14,"60-120",96],[0.14,"120-180",93],[0.14,"180-240",86],[0.14,"240-300",89],
|
|
[0.15,"0-30",99],[0.15,"30-60",97],[0.15,"60-120",93],[0.15,"120-180",92],[0.15,"180-240",89],[0.15,"240-300",79],
|
|
[0.16,"0-30",98],[0.16,"30-60",95],[0.16,"60-120",93],[0.16,"120-180",93],[0.16,"180-240",92],[0.16,"240-300",85],
|
|
[0.17,"0-30",100],[0.17,"30-60",98],[0.17,"60-120",96],[0.17,"120-180",93],[0.17,"180-240",96],[0.17,"240-300",74],
|
|
[0.18,"0-30",100],[0.18,"30-60",98],[0.18,"60-120",99],[0.18,"120-180",95],[0.18,"180-240",97],[0.18,"240-300",71],
|
|
[0.19,"0-30",100],[0.19,"30-60",97],[0.19,"60-120",98],[0.19,"120-180",98],[0.19,"180-240",94],[0.19,"240-300",58],
|
|
[0.2,"0-30",100],[0.2,"30-60",97],[0.2,"60-120",98],[0.2,"120-180",93],[0.2,"180-240",90],[0.2,"240-300",77],
|
|
[0.21,"0-30",98],[0.21,"30-60",98],[0.21,"60-120",97],[0.21,"120-180",95],[0.21,"180-240",81],[0.21,"240-300",77],
|
|
[0.22,"0-30",95],[0.22,"30-60",99],[0.22,"60-120",96],[0.22,"120-180",96],[0.22,"180-240",88],[0.22,"240-300",61],
|
|
[0.23,"0-30",97],[0.23,"30-60",100],[0.23,"60-120",100],[0.23,"120-180",100],[0.23,"180-240",93],[0.23,"240-300",65],
|
|
[0.24,"0-30",98],[0.24,"30-60",98],[0.24,"60-120",100],[0.24,"120-180",100],[0.24,"180-240",95],[0.24,"240-300",83],
|
|
[0.25,"0-30",95],[0.25,"30-60",96],[0.25,"60-120",100],[0.25,"120-180",99],[0.25,"180-240",98],[0.25,"240-300",89],
|
|
[0.26,"0-30",97],[0.26,"30-60",99],[0.26,"60-120",100],[0.26,"120-180",97],[0.26,"180-240",99],[0.26,"240-300",100],
|
|
[0.27,"0-30",100],[0.27,"30-60",99],[0.27,"60-120",100],[0.27,"120-180",97],[0.27,"180-240",100],[0.27,"240-300",96],
|
|
[0.28,"0-30",100],[0.28,"30-60",100],[0.28,"60-120",100],[0.28,"120-180",100],[0.28,"180-240",100],[0.28,"240-300",90],
|
|
[0.29,"0-30",100],[0.29,"30-60",100],[0.29,"60-120",100],[0.29,"120-180",100],[0.29,"180-240",100],[0.29,"240-300",100],
|
|
[0.3,"0-30",100],[0.3,"30-60",100],[0.3,"60-120",100],[0.3,"120-180",100],[0.3,"180-240",100],[0.3,"240-300",100],
|
|
[0.31,"0-30",100],[0.31,"30-60",100],[0.31,"60-120",100],[0.31,"120-180",100],[0.31,"180-240",100],[0.31,"240-300",86],
|
|
[0.32,"0-30",100],[0.32,"30-60",100],[0.32,"60-120",100],[0.32,"120-180",100],[0.32,"180-240",100],[0.32,"240-300",89],
|
|
[0.33,"0-30",100],[0.33,"30-60",100],[0.33,"60-120",100],[0.33,"120-180",100],[0.33,"180-240",100],[0.33,"240-300",100],
|
|
[0.34,"0-30",100],[0.34,"30-60",100],[0.34,"60-120",100],[0.34,"120-180",100],[0.34,"180-240",100],[0.34,"240-300",82],
|
|
[0.35,"0-30",100],[0.35,"30-60",100],[0.35,"60-120",100],[0.35,"120-180",100],[0.35,"180-240",100],[0.35,"240-300",77],
|
|
[0.36,"0-30",100],[0.36,"30-60",100],[0.36,"60-120",100],[0.36,"120-180",100],[0.36,"180-240",100],[0.36,"240-300",33],
|
|
[0.37,"0-30",100],[0.37,"30-60",100],[0.37,"60-120",100],[0.37,"120-180",100],[0.37,"180-240",100],[0.37,"240-300",50],
|
|
[0.38,"0-30",100],[0.38,"30-60",100],[0.38,"60-120",100],[0.38,"120-180",100],[0.38,"180-240",100],[0.38,"240-300",100],
|
|
[0.39,"0-30",100],[0.39,"30-60",100],[0.39,"60-120",100],[0.39,"120-180",100],[0.39,"180-240",100],[0.39,"240-300",100],
|
|
[0.4,"0-30",100],[0.4,"30-60",100],[0.4,"60-120",100],[0.4,"120-180",100],[0.4,"180-240",100],[0.4,"240-300",80],
|
|
];
|
|
|
|
// Fair probability tables per market — to add a new market, just add an entry here
|
|
export const FAIR_PROB_TABLES: Record<string, RawData> = {
|
|
"btc-5m": BTC_5M,
|
|
"eth-5m": ETH_5M,
|
|
// "btc-15m": BTC_15M, // to be calibrated
|
|
"sol-5m": SOL_5M,
|
|
};
|
|
|
|
// Bucket design per market (diff step + range) —— ETH/SOL price magnitudes are far smaller than BTC and need finer buckets
|
|
interface BucketSpec { step: number; min: number; max: number; }
|
|
const BUCKET_SPECS: Record<string, BucketSpec> = {
|
|
"btc-5m": { step: 2, min: -140, max: 96 },
|
|
"eth-5m": { step: 0.1, min: -7, max: 7 },
|
|
"sol-5m": { step: 0.01, min: -0.4, max: 0.4 },
|
|
};
|
|
|
|
// Precompile each table into a Map for O(1) lookup
|
|
const COMPILED_MAPS = new Map<string, Map<string, number>>();
|
|
for (const [marketKey, raw] of Object.entries(FAIR_PROB_TABLES)) {
|
|
const m = new Map<string, number>();
|
|
for (const [diff, rb, prob] of raw) m.set(`${diff},${rb}`, prob);
|
|
COMPILED_MAPS.set(marketKey, m);
|
|
}
|
|
|
|
export function getRemBin(rem: number): string | null {
|
|
// rem ≥ 240 all map to the 240-300 bin (handles rem = 300 or transient values right after a window switch)
|
|
// Note: all current tables are the 6 bins of the 5m period; adding a 15m table in the future requires extending this function
|
|
if (rem >= 240) return "240-300";
|
|
if (rem >= 180) return "180-240";
|
|
if (rem >= 120) return "120-180";
|
|
if (rem >= 60) return "60-120";
|
|
if (rem >= 30) return "30-60";
|
|
if (rem >= 0) return "0-30";
|
|
return null;
|
|
}
|
|
|
|
/** Look up the fair probability (%) by diff and rem; returns null when the current market has no table */
|
|
export function getFairProb(diff: number, rem: number): number | null {
|
|
const map = COMPILED_MAPS.get(activeMarketKey);
|
|
if (!map) return null;
|
|
const spec = BUCKET_SPECS[activeMarketKey];
|
|
if (!spec) return null;
|
|
const rb = getRemBin(rem);
|
|
if (!rb) return null;
|
|
// round + clamp per the current market's bucket spec
|
|
const rawDb = Math.round(diff / spec.step) * spec.step;
|
|
const dbClamped = Math.max(spec.min, Math.min(spec.max, rawDb));
|
|
// precision matches the generation side's round(x, 2): integer steps use integers; decimal steps keep 2 places
|
|
// (0.5 multiples are also exact at 2 places: 1.0/1.5/2.0...; a future 0.05 step would also match correctly)
|
|
const db = spec.step >= 1 ? dbClamped : Math.round(dbClamped * 100) / 100;
|
|
return map.get(`${db},${rb}`) ?? null;
|
|
}
|
|
|
|
/** Whether the current market has a fair-probability table (the frontend can use this to decide whether to enable p-series strategies) */
|
|
export function hasFairProbTable(marketKey?: string): boolean {
|
|
return COMPILED_MAPS.has(marketKey ?? activeMarketKey);
|
|
}
|
|
|
|
// Current active market key (synced by server.ts when switching markets)
|
|
let activeMarketKey = "btc-5m";
|
|
export function setActiveMarket(sym: string, period: string): void {
|
|
activeMarketKey = `${sym}-${period}`;
|
|
}
|
|
// Backward compatibility for old calls
|
|
export function setActiveSymbol(sym: string): void {
|
|
activeMarketKey = `${sym}-5m`;
|
|
}
|