I'm working on a project that involves copy trading, communication between exchange (binance, bybit) and our platform is managed through events. In future trading when a master trader places a order, the order is placed for all his community's members, each members quantity is different according to their risk ration. So the problem is when there are multiple orders opened for same master trader and his community members (with different quantity) and when master closes one of the open order how to identify what member order was opened with that specific order, because closing opened order in future is created as new order against the side (buy or sell) with same quantity, so I can't map it with unique id with the order was opened, because the closing order is a new order with different unique id.
I tried to map the master trader's order and with member's but won't work due to time delay for a API call, which according to my experience on bybit takes 500 ms for each hit, so if a master has 400 member in his community it would approximately 4 minutes for the last member so that would be a difference that can't be ignored because master trader can executes an other trade in meanwhile.
This is the event data I receive when the order is opened
update {
topic: 'order',
id: '101639358_XRPUSDT_55844250804',
creationTime: 1694154213584,
data: [
{
category: 'linear',
symbol: 'XRPUSDT',
orderId: 'face1293-61a4-4d0b-adc0-51847a8710a5',
orderLinkId: '',
blockTradeId: '',
side: 'Buy',
positionIdx: 0,
orderStatus: 'Filled',
cancelType: 'UNKNOWN',
rejectReason: 'EC_NoError',
timeInForce: 'IOC',
isLeverage: '',
price: '0.528',
qty: '10',
avgPrice: '0.503',
leavesQty: '0',
leavesValue: '0',
cumExecQty: '10',
cumExecValue: '5.03',
cumExecFee: '0.0027665',
orderType: 'Market',
stopOrderType: '',
orderIv: '',
triggerPrice: '',
takeProfit: '',
stopLoss: '',
triggerBy: '',
tpTriggerBy: '',
slTriggerBy: '',
triggerDirection: 0,
placeType: '',
lastPriceOnCreated: '0.5029',
closeOnTrigger: false,
reduceOnly: false,
smpGroup: 0,
smpType: 'None',
smpOrderId: '',
slLimitPrice: '0',
tpLimitPrice: '0',
tpslMode: 'UNKNOWN',
createdTime: '1694154213581',
updatedTime: '1694154213582',
feeCurrency: ''
}
],
,wsKey: 'v5Private'
}
And below is the event data when order is closed
update {
topic: 'order',
id: '101639358_XRPUSDT_55844475069',
creationTime: 1694154535211,
data: [
{
category: 'linear',
symbol: 'XRPUSDT',
orderId: '2dd74057-0324-42e9-b120-ad40fdfcaf10',
orderLinkId: '',
blockTradeId: '',
side: 'Sell',
positionIdx: 0,
orderStatus: 'Filled',
cancelType: 'UNKNOWN',
rejectReason: 'EC_NoError',
timeInForce: 'IOC',
isLeverage: '',
price: '0.4783',
qty: '10',
avgPrice: '0.5034',
leavesQty: '0',
leavesValue: '0',
cumExecQty: '10',
cumExecValue: '5.034',
cumExecFee: '0.0027687',
orderType: 'Market',
stopOrderType: '',
orderIv: '',
triggerPrice: '',
takeProfit: '',
stopLoss: '',
triggerBy: '',
tpTriggerBy: '',
slTriggerBy: '',
triggerDirection: 0,
placeType: '',
lastPriceOnCreated: '0.5034',
closeOnTrigger: true,
reduceOnly: true,
smpGroup: 0,
smpType: 'None',
smpOrderId: '',
slLimitPrice: '0',
tpLimitPrice: '0',
tpslMode: 'UNKNOWN',
createdTime: '1694154535207',
updatedTime: '1694154535209',
feeCurrency: ''
}
],
wsKey: 'v5Private'
}
Any theoretical or practical idea would be appreciable.