Hi All,
I was programming my bot today and I was mainly concerning myself with the "Part Match" problem.
I'm placing an order and checking the response to ensure the SizeMatched is equal to the Order Amount.
If these are not equal then the BOT drops into a loop (I assumed the ListCurrentOrders was the call to use) and circles through till the match is made (or cancelled after a period of time).
To make things easier, I was only passing one BETID (from the successful unmatched bet). So that only one BetResponse should come back.
Right, that's the back ground. Now when I stepped this through the code by performing some test bets (A bet that was in no way going to get matched) the loop was endless and was working as expected. However, when I attempted to run the code in a live scenario, it was crashing with an error. The error was that it was not bringing back the intended BetResponse in fact it brought back nothing.
I don't understand why this would not be bringing back details of a bet I know I just made and have had a response too lines of code earlier.
Sample of Code
-----------------------------------------------------------
// Check Bet
if (BetOrder.result.status == "SUCCESS")
{
BetID = BetOrder.result.instructionReports[0].placeInstructionReport.betId;
//Check Matched Size
if (BetOrder.result.instructionReports[0].placeInstructionReport.sizeMatched == _OrigSize)
{
ReturnDetails.AveragePriceMatched = BetOrder.result.instructionReports[0].placeInstructionReport.averagePriceMatched;
ReturnDetails.BetId = BetOrder.result.instructionReports[0].placeInstructionReport.betId;
ReturnDetails.SizeMatched = BetOrder.result.instructionReports[0].placeInstructionReport.sizeMatched;
ReturnDetails.Status =
BetOrder.result.status;
return ReturnDetails;
}
// Part Match Checker
List<String> BetIDs = new List<string>();
BetIDs.Add(BetID);
BF.Requests.ReqlistCurrentOrders CheckOrder =
new Requests.ReqlistCurrentOrders();
CheckOrder.@params.betIds = BetIDs;
BF.Responses.RespCurrentOrders CurrentOrders = JsonConvert.DeserializeObject<BF.Responses.RespCur rentOrders>(GetResponse(JsonConvert.SerializeObjec t(CheckOrder)));
//Loop
while (CurrentOrders.result.currentOrders[0].sizeMatched != Order.@params.instructions[0].limitOrder.size)
{
CurrentOrders = JsonConvert.DeserializeObject<BF.Responses.RespCur rentOrders>(GetResponse(JsonConvert.SerializeObjec t(CheckOrder)));
}
ReturnedDetails.AveragePriceMatched = CurrentOrders.result.currentOrders[0].averagePriceMatched;
ReturnedDetails.BetId =
CurrentOrders.result.currentOrders[0].betId;
ReturnedDetails.SizeMatched =
CurrentOrders.result.currentOrders[0].sizeMatched;
ReturnedDetails.Status =
CurrentOrders.result.currentOrders[0].status;
return ReturnedDetails;
-----------------------------------------------------------
Any ideas
I was programming my bot today and I was mainly concerning myself with the "Part Match" problem.
I'm placing an order and checking the response to ensure the SizeMatched is equal to the Order Amount.
If these are not equal then the BOT drops into a loop (I assumed the ListCurrentOrders was the call to use) and circles through till the match is made (or cancelled after a period of time).
To make things easier, I was only passing one BETID (from the successful unmatched bet). So that only one BetResponse should come back.
Right, that's the back ground. Now when I stepped this through the code by performing some test bets (A bet that was in no way going to get matched) the loop was endless and was working as expected. However, when I attempted to run the code in a live scenario, it was crashing with an error. The error was that it was not bringing back the intended BetResponse in fact it brought back nothing.
I don't understand why this would not be bringing back details of a bet I know I just made and have had a response too lines of code earlier.
Sample of Code
-----------------------------------------------------------
// Check Bet
if (BetOrder.result.status == "SUCCESS")
{
BetID = BetOrder.result.instructionReports[0].placeInstructionReport.betId;
//Check Matched Size
if (BetOrder.result.instructionReports[0].placeInstructionReport.sizeMatched == _OrigSize)
{
ReturnDetails.AveragePriceMatched = BetOrder.result.instructionReports[0].placeInstructionReport.averagePriceMatched;
ReturnDetails.BetId = BetOrder.result.instructionReports[0].placeInstructionReport.betId;
ReturnDetails.SizeMatched = BetOrder.result.instructionReports[0].placeInstructionReport.sizeMatched;
ReturnDetails.Status =
BetOrder.result.status;
return ReturnDetails;
}
// Part Match Checker
List<String> BetIDs = new List<string>();
BetIDs.Add(BetID);
BF.Requests.ReqlistCurrentOrders CheckOrder =
new Requests.ReqlistCurrentOrders();
CheckOrder.@params.betIds = BetIDs;
BF.Responses.RespCurrentOrders CurrentOrders = JsonConvert.DeserializeObject<BF.Responses.RespCur rentOrders>(GetResponse(JsonConvert.SerializeObjec t(CheckOrder)));
//Loop
while (CurrentOrders.result.currentOrders[0].sizeMatched != Order.@params.instructions[0].limitOrder.size)
{
CurrentOrders = JsonConvert.DeserializeObject<BF.Responses.RespCur rentOrders>(GetResponse(JsonConvert.SerializeObjec t(CheckOrder)));
}
ReturnedDetails.AveragePriceMatched = CurrentOrders.result.currentOrders[0].averagePriceMatched;
ReturnedDetails.BetId =
CurrentOrders.result.currentOrders[0].betId;
ReturnedDetails.SizeMatched =
CurrentOrders.result.currentOrders[0].sizeMatched;
ReturnedDetails.Status =
CurrentOrders.result.currentOrders[0].status;
return ReturnedDetails;
-----------------------------------------------------------
Any ideas


Comment