dbo.fn_BetProperty(id_trade, bet_num, property)

(decimal) Returns properties of a bet.

Input parameters:
id_trade (integer)Id of the trade
bet_num (integer)Index of the bet
property (string) Can return one of the following properties:
  • 'avg_price' = average price of a matched bet. The value is weighted with the amounts. If no part of the bet has been matched the function returns 0.
  • 'matched_size' = total amount of sizes matched
  • 'original_price' = the original requested price of the bet (before eventual updates).
  • 'original_size' = the original requested size of the bet (before eventual updates).
  • 'required_price' = required price of the bet (during an update)
  • 'required_size' = required size of the bet (during an update)
  • 'status' = status of the bet. Can be:
    0 = not exists
    1 = new (waiting for BF confirmation)
    2 = umatched (with BF confirmation)
    3 = partially matched
    4 = full matched
    5 = cancelled
    6 = settled
    7 = lapsed
  • 'remaining_size' = size of the bet remained unmatched


<bet index="2" bid_type="l">
<place condition="(dbo.fn_betproperty(@id_trade,1,'status') = 4)"
close_trade="y" />

If the first bet of the current trade has been matched, place a second bet of size 2 at the best lay price.
datediff and getdate are a Microsoft Sql Server internal functions.