options flow bugfixing

This commit is contained in:
MuslemRahimi 2024-09-16 18:21:41 +02:00
parent a2421b7632
commit 7881726ad0
3 changed files with 10 additions and 15 deletions

View File

@ -51,5 +51,4 @@ $: charNumber = $screenWidth < 640 ? 20 : 30;
</section> </section>

View File

@ -15,21 +15,14 @@
let ruleOfList = [ let ruleOfList = [
{ {
"name": "underlying_type", "name": "cost_basis",
"value": "any"
},
{
"name": "put_call",
"value": "any" "value": "any"
}, },
{ {
"name": "date_expiration", "name": "date_expiration",
"value": "any" "value": "any"
}, },
{ ];
"name": "execution_estimate",
"value": "any"
}];
let displayRules = []; let displayRules = [];
let filterQuery = ''; let filterQuery = '';
@ -42,10 +35,10 @@
let shouldLoadWorker = writable(false); let shouldLoadWorker = writable(false);
const allRules = { const allRules = {
volume: { label: 'Volume', step: ['100K','10K','1K'], defaultCondition: 'over', defaultValue: '1K' }, volume: { label: 'Volume', step: ['100K','10K','1K'], defaultCondition: 'over', defaultValue: 'any' },
open_interest: { label: 'Open Interest', step: ['100K','10K','1K'], defaultCondition: 'over', defaultValue: '1K' }, open_interest: { label: 'Open Interest', step: ['100K','10K','1K'], defaultCondition: 'over', defaultValue: 'any' },
volumeOIRatio: { label: 'Volume / Open Interest', step: ['100%','80%','60%','50%','30%','15%','10%','5%'], defaultCondition: 'over', defaultValue: 'any' }, volumeOIRatio: { label: 'Volume / Open Interest', step: ['100%','80%','60%','50%','30%','15%','10%','5%'], defaultCondition: 'over', defaultValue: 'any' },
cost_basis: { label: 'Premium', step: ['10M','5M','1M','500K','100K','50K','10K','5K'], defaultCondition: 'over', defaultValue: '50K' }, cost_basis: { label: 'Premium', step: ['10M','5M','1M','500K','100K','50K','10K','5K'], defaultCondition: 'over', defaultValue: 'any' },
put_call: { label: 'Contract Type', step: ["Calls", "Puts"], defaultValue: 'any' }, put_call: { label: 'Contract Type', step: ["Calls", "Puts"], defaultValue: 'any' },
sentiment: { label: 'Sentiment', step: ["Bullish","Neutral", "Bearish"], defaultValue: 'any' }, sentiment: { label: 'Sentiment', step: ["Bullish","Neutral", "Bearish"], defaultValue: 'any' },
execution_estimate: { label: 'Execution', step: ["At Ask","At Bid", "At Midpoint", "Below Ask", "Below Bid",], defaultValue: 'any' }, execution_estimate: { label: 'Execution', step: ["At Ask","At Bid", "At Midpoint", "Below Ask", "Below Bid",], defaultValue: 'any' },

View File

@ -186,7 +186,10 @@ async function filterRawData(rawData, ruleOfList, filterQuery) {
onmessage = async (event: MessageEvent) => { onmessage = async (event: MessageEvent) => {
const { rawData, ruleOfList, filterQuery } = event.data || {}; const { rawData, ruleOfList, filterQuery } = event.data || {};
const filteredData = await filterRawData(rawData, ruleOfList, filterQuery); let filteredData = await filterRawData(rawData, ruleOfList, filterQuery);
filteredData = Array?.from(
new Map(filteredData?.map((item) => [item?.id, item]))?.values()
);
postMessage({ message: "success", filteredData }); postMessage({ message: "success", filteredData });
}; };