-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLBS_BetFairAPINGClasses.pas
3212 lines (2347 loc) · 127 KB
/
LBS_BetFairAPINGClasses.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit LBS_BetfairAPINGClasses ;
interface
uses sysutils, classes, generics.collections, SuperObject ;
type TTriState = (triTrue, triFalse, triNone) ;
type
EbfAPIError = class(Exception)
private
fErrorCode : integer ;
fMessage : string ;
fRequest : string ;
fResponse : string ;
public
constructor Create(aErrorCode : integer ;
aMessage : string ;
aSORequest : ISuperObject ;
aResponse : string ) ;
property ErrorCode : integer read fErrorCode ;
property Message : string read fMessage ;
property sRequest : string read fRequest ;
property sResponse : string read fResponse ;
end ;
type
EbfhttpError = class(EbfAPIError) ;
EbfFunctionError = class(EbfAPIError) ;
type TbfngMarketProjection = ( bfmpjUnknown,
bfmpjCOMPETITION, {If not selected then the competition will not be returned with marketCatalogue}
bfmpfEVENT, {If not selected then the event will not be returned with marketCatalogue}
bfmpjEVENT_TYPE, {If not selected then the eventType will not be returned with marketCatalogue}
bfmpjMARKET_START_TIME, {If not selected then the start time will not be returned with marketCatalogue}
bfmpjMARKET_DESCRIPTION, {If not selected then the description will not be returned with marketCatalogue}
bfmpjRUNNER_DESCRIPTION, {If not selected then the runners will not be returned with marketCatalogue}
bfmpjRUNNER_METADATA ) ; {If not selected then the runner metadata will not be returned with marketCatalogue.
If selected then RUNNER_DESCRIPTION will also be returned regardless of whether it is included as a market projection.}
type TbfngMarketProjectionSet = set of TbfngMarketProjection ;
type TbfngPriceData = ( bfpdUnknown,
bfpdSP_AVAILABLE, {Amount available for the BSP auction.}
bfpdSP_TRADED, {Amount traded in the BSP auction.}
bfpdEX_BEST_OFFERS, {Only the best prices available for each runner, to requested price depth.}
bfpdEX_ALL_OFFERS, {EX_ALL_OFFERS trumps EX_BEST_OFFERS if both settings are present}
bfpdEX_TRADED ) ; {Amount traded on the exchange.}
type TbfngPriceDataSet = set of TbfngPriceData ;
type TbfngMatchProjection = ( bfmtpNone,
bfmtpNO_ROLLUP, {No rollup, return raw fragments}
bfmtpROLLED_UP_BY_PRICE, {Rollup matched amounts by distinct matched prices per side.}
bfmtpROLLED_UP_BY_AVG_PRICE ) ; {Rollup matched amounts by average matched price per side}
type TbfngOrderProjection = ( bforpNone,
bforpALL, {EXECUTABLE and EXECUTION_COMPLETE orders}
bforpEXECUTABLE, {An order that has a remaining unmatched portion}
bforpEXECUTION_COMPLETE ) ; {An order that does not have any remaining unmatched portion}
type TbfngMarketStatus = ( bfmksUnknown,
bfmksINACTIVE, {Inactive Market}
bfmksOPEN, {Open Market}
bfmksSUSPENDED, {Suspended Market}
bfmksCLOSED ) ; {Closed Market}
type TbfngRunnerStatus = ( bfrnsUnknown,
bfrnsACTIVE,
bfrnsWINNER,
bfrnsLOSER,
bfrnsREMOVED_VACANT, {REMOVED_VACANT applies to Greyhounds. Greyhound markets always return a fixed number of runners (traps).
If a dog has been removed, the trap is shown as vacant.}
bfrnsREMOVED ) ;
type TbfngTimeGranularity = ( bftgUnknown,
bftgDAYS,
bftgHOURS,
bftgMINUTES ) ;
type TbfngSide = ( bfsideUnknown,
bfsideBACK, {To back a team, horse or outcome is to bet on the selection to win.}
bfsideLAY ) ; {To lay a team, horse, or outcome is to bet on the selection to lose.}
type TbfngOrderStatus = ( bfordstUnknown,
bfordstEXECUTION_COMPLETE, {An order that does not have any remaining unmatched portion.}
bfordstEXECUTABLE ) ; {An order that has a remaining unmatched portion.}
type TbfngOrderBy = ( bfordbyNone,
bfordbyBY_BET, {Order by placed time, then bet id.}
bfordbyBY_MARKET, {Order by market id, then placed time, then bet id.}
bfordbyBY_MATCH_TIME ) ; {Order by time of last matched fragment (if any), then placed time, then bet id}
type TbfngSortDir = ( bfsortdirNone,
bfsortdirEARLIEST_TO_LATEST, {Order from earliest value to latest e.g. lowest betId is first in the results.}
bfsortdirLATEST_TO_EARLIEST ) ; {Order from the latest value to the earliest e.g. highest betId is first in the results.}
type TbfngOrderType = ( bfordtypUnknown,
bfordtypLIMIT, {A normal exchange limit order for immediate execution}
bfordtypLIMIT_ON_CLOSE, {Limit order for the auction (SP)}
bfordtypMARKET_ON_CLOSE ) ; {Market order for the auction (SP)}
type TbfngMarketSort = ( bfmsortMINIMUM_TRADED, {Minimum traded volume}
bfmsortMAXIMUM_TRADED, {Maximum traded volume}
bfmsortMINIMUM_AVAILABLE, {Minimum available to match}
bfmsortMAXIMUM_AVAILABLE, {Maximum available to match}
bfmsortFIRST_TO_START, {The closest markets based on their expected start time}
bfmosrtLAST_TO_START ) ; {The most distant markets based on their expected start time}
type TbfngMarketBettingType = ( bfmbtUnknown,
bfmbtODDS, {Odds Market}
bfmbtLINE, {Line Market}
bfmbtRANGE, {Range Market}
bfmbtASIAN_HANDICAP_DOUBLE_LINE, {Asian Handicap Market}
bfmbtASIAN_HANDICAP_SINGLE_LINE, {Asian Single Line Market}
bfmbtFIXED_ODDS ) ; {Sportsbook Odds Market. This type is deprecated and will be removed in future releases, when Sportsbook markets will be represented as ODDS market but with a different product type.}
type TbfngMarketBettingTypeSet = set of TbfngMarketBettingType ;
type TbfngExecutionReportStatus= ( bfersUnknown,
bfersSUCCESS, {Order processed successfully}
bfersFAILURE, {Order failed.}
bfersPROCESSED_WITH_ERRORS, {The order itself has been accepted, but at least one (possibly all) actions have generated errors}
bfersTIMEOUT ) ; {Order timed out.}
type TbfngExecutionReportErrorCode
= ( bferecUnknown,
bferecERROR_IN_MATCHER, {The matcher is not healthy}
bferecPROCESSED_WITH_ERRORS, {The order itself has been accepted, but at least one (possibly all) actions have generated errors}
bferecBET_ACTION_ERROR, {There is an error with an action that has caused the entire order to be rejected}
bferecINVALID_ACCOUNT_STATE, {Order rejected due to the account's status (suspended, inactive, dup cards)}
bferecINVALID_WALLET_STATUS, {Order rejected due to the account's wallet's status}
bferecINSUFFICIENT_FUNDS, {Account has exceeded its exposure limit or available to bet limit}
bferecLOSS_LIMIT_EXCEEDED, {The account has exceed the self imposed loss limit}
bferecMARKET_SUSPENDED, {Market is suspended}
bferecMARKET_NOT_OPEN_FOR_BETTING, {Market is not open for betting, either inactive, suspended or closed}
bferecDUPLICATE_TRANSACTION, {duplicate customer referece data submitted}
bferecINVALID_ORDER, {Order cannot be accepted by the matcher due to the combination of actions.
For example, bets being edited are not on the same market, or order includes both edits and placement}
bferecINVALID_MARKET_ID, {Market doesn't exist}
bferecPERMISSION_DENIED, {Business rules do not allow order to be placed}
bferecDUPLICATE_BETIDS, {duplicate bet ids found}
bferecNO_ACTION_REQUIRED, {Order hasn't been passed to matcher as system detected there will be no state change}
bferecSERVICE_UNAVAILABLE, {The requested service is unavailable}
bferecREJECTED_BY_REGULATOR ) ; {The regulator rejected the order}
type TbfngPersistenceType = ( bfperstypUnknown,
bfperstypLAPSE, {Lapse the order at turn-in-play}
bfperstypPERSIST, {Persist the order to in-play}
bfperstypMARKET_ON_CLOSE ) ; {Put the order into the auction (SP) at turn-in-play}
type TbfngInstructionReportStatus
= ( bfirsUnknown,
bfirsSUCCESS,
bfirsFAILURE,
bfirsTIMEOUT ) ;
type TbfngInstructionReportErrorCode
= ( bfirecUnknown,
bfirecINVALID_BET_SIZE, {bet size is invalid for your currency or your regulator}
bfirecINVALID_RUNNER, {Runner does not exist, includes vacant traps in greyhound racing}
bfirecBET_TAKEN_OR_LAPSED, {Bet cannot be cancelled or modified as it has already been taken or has lapsed Includes attempts to cancel/modify market on close BSP bets and cancelling limit on close BSP bets}
bfirecBET_IN_PROGRESS, {No result was received from the matcher in a timeout configured for the system}
bfirecRUNNER_REMOVED, {Runner has been removed from the event}
bfirecMARKET_NOT_OPEN_FOR_BETTING, {Attempt to edit a bet on a market that has closed.}
bfirecLOSS_LIMIT_EXCEEDED, {The action has caused the account to exceed the self imposed loss limit}
bfirecMARKET_NOT_OPEN_FOR_BSP_BETTING, {Market now closed to bsp betting. Turned in-play or has been reconciled}
bfirecINVALID_PRICE_EDIT, {Attempt to edit down the price of a bsp limit on close lay bet, or edit up the price of a limit on close back bet}
bfirecINVALID_ODDS, {Odds not on price ladder - either edit or placement}
bfirecINSUFFICIENT_FUNDS, {Insufficient funds available to cover the bet action. Either the exposure limit or available to bet limit would be exceeded}
bfirecINVALID_PERSISTENCE_TYPE, {Invalid persistence type for this market, e.g. KEEP for a non bsp market}
bfirecERROR_IN_MATCHER, {A problem with the matcher prevented this action completing successfully}
bfirecINVALID_BACK_LAY_COMBINATION, {The order contains a back and a lay for the same runner at overlapping prices. This would guarantee a self match.
This also applies to BSP limit on close bets}
bfirecERROR_IN_ORDER, {The action failed because the parent order failed}
bfirecINVALID_BID_TYPE, {Bid type is mandatory}
bfirecINVALID_BET_ID, {Bet for id supplied has not been found}
bfirecCANCELLED_NOT_PLACED, {Bet cancelled but replacement bet was not placed}
bfirecRELATED_ACTION_FAILED, {Action failed due to the failure of a action on which this action is dependent}
bfirecNO_ACTION_REQUIRED ) ; {the action does not result in any state change. eg changing a persistence to it's current value}
type TbfngRollupModel = ( bfrollupSTAKE, {The volumes will be rolled up to the minimum value which is >= rollupLimit.}
bfrollupPAYOUT, {The volumes will be rolled up to the minimum value where the payout( price * volume ) is >= rollupLimit.}
bfrollupMANAGED_LIABILITY, {The volumes will be rolled up to the minimum value which is >= rollupLimit, until a lay price threshold.
There after, the volumes will be rolled up to the minimum value such that the liability >= a minimum liability.
Not supported as yet.}
bfrollupNONE ) ; {No rollup will be applied. However the volumes will be filtered by currency specific minimum stake unless overridden specifically for the channel.}
type TbfngGroupBy = ( bfgrpbyNone,
bfgrpbyEVENT_TYPE, {A roll up of settled P&L, commission paid and number of bet orders, on a specified event type}
bfgrpbyEVENT, {A roll up of settled P&L, commission paid and number of bet orders, on a specified event}
bfgrpbyMARKET, {A roll up of settled P&L, commission paid and number of bet orders, on a specified market}
bfgrpbyRUNNER, {A roll up of settled P&L and the number of bet orders, on a specified runner within a specified market}
bfgrpbySIDE, {An averaged roll up of settled P&L, and number of bets, on the specified side of a specified selection within a specified market,
that are either settled or voided}
bfgrpbyBET ) ; {The P&L, commission paid, side and regulatory information etc, about each individual bet order}
type TbfngBetStatus = ( bfbetstUnknown,
bfbetstSETTLED, {A matched bet that was settled normally}
bfbetstVOIDED, {A matched bet that was subsequently voided by Betfair, before, during or after settlement}
bfbetstLAPSED, {Unmatched bet that was cancelled by Betfair (for example at turn in play).}
bfbetstCANCELLED ) ; {Unmatched bet that was cancelled by an explicit customer action.}
type TbfngItemClass = ( bfitcUNKNOWN ) ; {Statement item not mapped to a specific class. All values will be concatenated into a single key/value pair.
The key will be 'unknownStatementItem' and the value will be a comma separated string.}
type TbfngWallet = ( bfwalletUK, bfwalletAUSTRALIAN ) ;
type TbfngIncludeItem = ( bfiitALL, {Include all items}
bfiitDEPOSITS_WITHDRAWALS, {Include payments only}
bfiitEXCHANGE, {Include exchange bets only}
bfiitPOKER_ROOM ) ; {Include poker transactions only}
{************************************************************}
{ Class structure for holding a Betfair TimeRange. }
{************************************************************}
type TbfTimeRangeObj = class(TObject)
private
fFrom : TDateTime ;
fTo : TDateTime ;
public
constructor Create ;
destructor Destroy ; override ;
property dFrom : TDateTime read fFrom write fFrom ;
property dTo : TDateTime read fTo write fTo ;
end ;
{************************************************************}
{ Class structure for holding a Betfair TimeRangeResult. }
{************************************************************}
type TbfTimeRangeResultObj = class(TObject)
private
fbfTimeRange : TbfTimeRangeObj ;
fMarketCount : longint ;
public
constructor Create ;
destructor Destroy ; override ;
property obfTimeRange : TbfTimeRangeObj read fbfTimeRange write fbfTimeRange ;
property iMarketCount : longint read fMarketCount write fMarketCount ;
end ;
type ArrayOfTbfTimeRangeResultObj = array of TbfTimeRangeResultObj ;
{************************************************************}
{ Class structure for holding a Betfair CountryCodeResult. }
{************************************************************}
type TbfCountryCodeResultObj = class(TObject)
private
fCountryCode : string ;
fMarketCount : longint ;
public
constructor Create ;
destructor Destroy ; override ;
property sCountryCode : string read fCountryCode write fCountryCode ;
property iMarketCount : longint read fMarketCount write fMarketCount ;
end ;
type ArrayOfTbfCountryCodeResultObj = array of TbfCountryCodeResultObj ;
{************************************************************}
{ Class structure for holding a Betfair VenueResult. }
{************************************************************}
type TbfVenueResultObj = class(TObject)
private
fVenue : string ;
fMarketCount : longint ;
public
constructor Create ;
destructor Destroy ; override ;
property sVenue : string read fVenue write fVenue ;
property iMarketCount : longint read fMarketCount write fMarketCount ;
end ;
type ArrayOfTbfVenueResultObj = array of TbfVenueResultObj ;
{************************************************************}
{ Class structure for holding a Betfair MarketTypeResult. }
{************************************************************}
type TbfMarketTypeResultObj = class(TObject)
private
fMarketType : string ;
fMarketCount : longint ;
public
constructor Create ;
destructor Destroy ; override ;
property sMarketType : string read fMarketType write fMarketType ;
property iMarketCount : longint read fMarketCount write fMarketCount ;
end ;
type ArrayOfTbfMarketTypeResultObj = array of TbfMarketTypeResultObj ;
{************************************************************}
{ Class structure for holding a Betfair Competition. }
{************************************************************}
type TbfCompetitionObj = class(TObject)
private
fCompetitionId : string ;
fCompetitionName : string ;
public
constructor Create ;
destructor Destroy ; override ;
property sCompetitionId : string read fCompetitionId write fCompetitionId ;
property sCompetitionName : string read fCompetitionName write fCompetitionName ;
end ;
{************************************************************}
{ Class structure for holding a Betfair EventType. }
{************************************************************}
type TbfEventTypeObj = class(TObject)
private
fEventTypeId : string ;
fEventTypeName : string ;
public
constructor Create ;
destructor Destroy ; override ;
property sEventTypeId : string read fEventTypeId write fEventTypeId ;
property sEventTypeName : string read fEventTypeName write fEventTypeName ;
end ;
{************************************************************}
{ Class structure for holding a Betfair Event. }
{************************************************************}
type TbfEventObj = class(TObject)
private
fEventId : string ; {The unique id for the event}
fEventName : string ; {The name of the event}
fCountryCode : string ; {The ISO-2 code for the event. A list of ISO-2 codes is available via http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2}
fTimezone : string ; {The timezone in which the event is taking place}
fVenue : string ; {Venue}
fOpenDate : TDateTime ; {The scheduled start date and time of the event.}
public
constructor Create ;
destructor Destroy ; override ;
property sEventId : string read fEventId write fEventId ;
property sEventName : string read fEventName write fEventName ;
property sCountryCode : string read fCountryCode write fCountryCode ;
property sTimezone : string read fTimezone write fTimezone ;
property sVenue : string read fVenue write fVenue ;
property dOpenDate : TDateTime read fOpenDate write fOpenDate ;
end ;
{************************************************************}
{ Class structure for holding results from listEventTypes. }
{************************************************************}
type TbfListEventTypesResultObj = class(TObject)
private
fbfEventType : TbfEventTypeObj ;
fMarketCount : longint ;
public
constructor Create ;
destructor Destroy ; override ;
property obfEventType : TbfEventTypeObj read fbfEventType write fbfEventType ;
property iMarketCount : longint read fMarketCount write fMarketCount ;
end ;
type ArrayOfTbfListEventTypesResultObj = array of TbfListEventTypesResultObj ;
{************************************************************}
{ Class structure for holding results from listCompetitions. }
{************************************************************}
type TbfListCompetitionsResultObj = class(TObject)
private
fbfCompetition : TbfCompetitionObj ;
fMarketCount : longint ;
fCompetitionRegion : string ;
public
constructor Create ;
destructor Destroy ; override ;
property obfCompetition : TbfCompetitionObj read fbfCompetition write fbfCompetition ;
property iMarketCount : longint read fMarketCount write fMarketCount ;
property sCompetitionRegion : string read fCompetitionRegion write fCompetitionRegion ;
end ;
type ArrayOfTbfListCompetitionsResultObj = array of TbfListCompetitionsResultObj ;
{************************************************************}
{ Class structure for holding results from listEvents. }
{************************************************************}
type TbfListEventsResultObj = class(TObject)
private
fbfEvent : TbfEventObj ;
fMarketCount : longint ;
public
constructor Create ;
destructor Destroy ; override ;
property obfEvent : TbfEventObj read fbfEvent write fbfEvent ;
property iMarketCount : longint read fMarketCount write fMarketCount ;
end ;
type ArrayOfTbfListEventsResultObj = array of TbfListEventsResultObj ;
{***************************************************}
{ Class structure for holding a Market Description. }
{***************************************************}
type TbfMarketDescriptionObj = class(TObject)
private
fPersistenceEnabled : boolean ; {If 'true' the market supports 'Keep' bets if the market is to be turned in-play}
fBSPMarket : boolean ; {If 'true' the market supports Betfair SP betting}
fMarketTime : TDateTime ; {The market start time}
fSuspendTime : TDateTime ; {The market suspend time}
fSettleTime : TDateTime ; {Settled time}
fBettingType : TbfngMarketBettingType ; {Market Betting Type}
fTurnInPlayEnabled : boolean ; {If 'true' the market is set to turn in-play}
fMarketType : string ; {Market base type}
fRegulator : string ; {The market regulator}
fMarketBaseRate : double ; {The commission rate applicable to the market}
fDiscountAllowed : boolean ; {Indicates whether or not the user's discount rate is taken into account on this market. If false all users will be charged the same commission rate, regardless of discount rat}
fWallet : string ; {The wallet to which the market belongs (UK/AUS)}
fRules : string ; {The market rules.}
fRulesHasDate : boolean ;
fClarifications : string ; {Any additional information regarding the market}
public
constructor Create ;
destructor Destroy ; override ;
property bPersistenceEnabled : boolean read fPersistenceEnabled write fPersistenceEnabled ;
property bBSPMarket : boolean read fBSPMarket write fBSPMarket ;
property dMarketTime : TDateTime read fMarketTime write fMarketTime ;
property dSuspendTime : TDateTime read fSuspendTime write fSuspendTime ;
property dSettleTime : TDateTime read fSettleTime write fSettleTime ;
property eBettingType : TbfngMarketBettingType read fBettingType write fBettingType ;
property bTurnInPlayEnabled : boolean read fTurnInPlayEnabled write fTurnInPlayEnabled ;
property sMarketType : string read fMarketType write fMarketType ;
property sRegulator : string read fRegulator write fRegulator ;
property rMarketBaseRate : double read fMarketBaseRate write fMarketBaseRate ;
property bDiscountAllowed : boolean read fDiscountAllowed write fDiscountAllowed ;
property sWallet : string read fWallet write fWallet ;
property sRules : string read fRules write fRules ;
property bRulesHasDate : boolean read fRulesHasDate write fRulesHasDate ;
property sClarifications : string read fClarifications write fClarifications ;
end ;
{*************************************************}
{ Class structure for holding a Runner Catalogue. }
{*************************************************}
type TbfRunnerCatalogueObj = class(TObject)
private
fSelectionId : int64 ; {The unique id for the selection.}
fRunnerName : string ; {The name of the runner}
fHandicap : double ; {The handicap}
fSortPriority : longint ; {The sort priority of this runner}
fMetaData : TDictionary<string, string> ; {Metadata associated with the runner}
public
constructor Create ;
destructor Destroy ; override ;
property iSelectionId : int64 read fSelectionId write fSelectionId ;
property sRunnerName : string read fRunnerName write fRunnerName ;
property rHandicap : double read fHandicap write fHandicap ;
property iSortPriority : longint read fSortPriority write fSortPriority ;
property dictMetaData : TDictionary<string, string> read fMetaData write fMetaData ;
end ;
type ArrayOfTbfRunnerCatalogueObj = array of TbfRunnerCatalogueObj ;
{*************************************************}
{ Class structure for holding a Market Catalogue. }
{*************************************************}
type TbfMarketCatalogueObj = class(TObject)
private
fMarketId : string ;
fMarketName : string ;
fMarketStartTime : TDateTime ;
fMarketDesc : TbfMarketDescriptionObj ;
fEventType : TbfEventTypeObj ;
fCompetition : TbfCompetitionObj ;
fEvent : TbfEventObj ;
public
constructor Create ;
destructor Destroy ; override ;
var
aRunners : ArrayOfTbfRunnerCatalogueObj ;
property sMarketId : string read fMarketId write fMarketId ;
property sMarketName : string read fMarketName write fMarketName ;
property dMarketStartTime : TDateTime read fMarketStartTime write fMarketStartTime ;
property oMarketDesc : TbfMarketDescriptionObj read fMarketDesc write fMarketDesc ;
property oEventType : TbfEventTypeObj read fEventType write fEventType ;
property oCompetition : TbfCompetitionObj read fCompetition write fCompetition ;
property oEvent : TbfEventObj read fEvent write fEvent ;
end ;
type ArrayOfTbfMarketCatalogueObj = array of TbfMarketCatalogueObj ;
{**************************************************************}
{ Class structure for holding an ExBestOffersOverrides object. }
{**************************************************************}
type TbfExBestOffersOverridesObj = class(TObject)
private
fBestPricesDepth : integer ;
fRollupModel : TbfngRollupModel ;
fRollupLimit : integer ;
fRollupLiabilityThreshold : double ;
fRollupLiabilityFactor : integer ;
public
constructor Create ;
destructor Destroy ; override ;
property iBestPricesDepth : integer read fBestPricesDepth write fBestPricesDepth ;
property eRollupModel : TbfngRollupModel read fRollupModel write fRollupModel ;
property iRollupLimit : integer read fRollupLimit write fRollupLimit ;
property rRollupLiabilityThreshold : double read fRollupLiabilityThreshold write fRollupLiabilityThreshold ;
property iRollupLiabilityFactor : integer read fRollupLiabilityFactor write fRollupLiabilityFactor ;
end ;
{*************************************************************}
{ Class structure for holding a PriceProjection. }
{*************************************************************}
type TbfPriceProjectionObj = class(TObject)
private
fPriceData : TbfngPriceDataSet ;
fExBestOffersOverrides : TbfExBestOffersOverridesObj ; {Only created if required}
fVirtualise : boolean ;
fRolloverStakes : boolean ;
public
constructor Create ;
destructor Destroy ; override ;
property setPriceData : TbfngPriceDataSet read fPriceData write fPriceData ;
property oBestOffersOverrides : TbfExBestOffersOverridesObj read fExBestOffersOverrides write fExBestOffersOverrides ;
property bVirtualise : boolean read fVirtualise write fVirtualise ;
property bRolloverStakes : boolean read fRolloverStakes write fRolloverStakes ;
end ;
{*************************************************************}
{ Class structure for holding a Betfair Order. }
{*************************************************************}
type TbfOrderObj = class(TObject)
private
fBetId : string ;
fOrderType : TbfngOrderType ;
fOrderStatus : TbfngOrderStatus ;
fPersistenceType : TbfngPersistenceType ;
fOrderSide : TbfngSide ;
fOrderPrice : double ;
fOrderSize : double ;
fBSPLiability : double ;
fPlacedDate : TDateTime ;
fAvgPriceMatched : double ;
fSizeMatched : double ;
fSizeRemaining : double ;
fSizeLapsed : double ;
fSizeCancelled : double ;
fSizeVoided : double ;
public
constructor Create ;
destructor Destroy ; override ;
property sBetId : string read fBetId write fBetId ;
property eOrderType : TbfngOrderType read fOrderType write fOrderType ;
property eOrderStatus : TbfngOrderStatus read fOrderStatus write fOrderStatus ;
property ePersistenceType : TbfngPersistenceType read fPersistenceType write fPersistenceType ;
property eOrderSide : TbfngSide read fOrderSide write fOrderSide ;
property rOrderPrice : double read fOrderPrice write fOrderPrice ;
property rOrderSize : double read fOrderSize write fOrderSize ;
property rBSPLiability : double read fBSPLiability write fBSPLiability ;
property dPlacedDate : TDateTime read fPlacedDate write fPlacedDate ;
property rAvgPriceMatched : double read fAvgPriceMatched write fAvgPriceMatched ;
property rSizeMatched : double read fSizeMatched write fSizeMatched ;
property rSizeRemaining : double read fSizeRemaining write fSizeRemaining ;
property rSizeLapsed : double read fSizeLapsed write fSizeLapsed ;
property rSizeCancelled : double read fSizeCancelled write fSizeCancelled ;
property rSizeVoided : double read fSizeVoided write fSizeVoided ;
end ;
type ArrayOfTbfOrderObj = array of TbfOrderObj ;
{*************************************************************}
{ Class structure for holding a Betfair Match. }
{*************************************************************}
type TbfMatchObj = class(TObject)
private
fBetId : string ;
fMatchId : string ;
fSide : TbfngSide ;
fPrice : double ;
fSize : double ;
fMatchDate : TDateTime ;
public
constructor Create ;
destructor Destroy ; override ;
property sBetId : string read fBetId write fBetId ;
property sMatchId : string read fMatchId write fMatchId ;
property eSide : TbfngSide read fSide write fSide ;
property rPrice : double read fPrice write fPrice ;
property rSize : double read fSize write fSize ;
property dMatchDate : TDateTime read fMatchDate write fMatchDate ;
end ;
type ArrayOfTbfMatchObj = array of TbfMatchObj ;
{*************************************************************}
{ Class structure for holding a PriceSize. }
{*************************************************************}
type TbfPriceSizeObj = class(TObject)
private
fPrice : double ;
fSize : double ;
public
constructor Create ;
destructor Destroy ; override ;
property rPrice : double read fPrice write fPrice ;
property rSize : double read fSize write fSize ;
end ;
type ArrayOfTbfPriceSizeObj = array of TbfPriceSizeObj ;
{*************************************************************}
{ Class structure for holding StartingPrices. }
{*************************************************************}
type TbfStartingPricesObj = class(TObject)
private
fNearPrice : double ;
fFarPrice : double ;
fActualSP : double ;
public
constructor Create ;
destructor Destroy ; override ;
var
aBackStakeTaken : ArrayOfTbfPriceSizeObj ;
aLayLiabilityTaken : ArrayOfTbfPriceSizeObj ;
property rNearPrice : double read fNearPrice write fNearPrice ;
property rFarPrice : double read fFarPrice write fFarPrice ;
property rActualSP : double read fActualSP write fActualSP ;
end ;
type ArrayOfTbfStartingPricesObj = array of TbfStartingPricesObj ;
{*************************************************************}
{ Class structure for holding ExchangePrices. }
{*************************************************************}
type TbfExchangePricesObj = class(TObject)
private
public
constructor Create ;
destructor Destroy ; override ;
var
aAvailableToBack : ArrayOfTbfPriceSizeObj ;
aAvailableToLay : ArrayOfTbfPriceSizeObj ;
aTradedVolume : ArrayOfTbfPriceSizeObj ;
end ;
type ArrayOfTbfExchangePricesObj = array of TbfExchangePricesObj ;
{*************************************************************}
{ Class structure for holding a Runner. }
{*************************************************************}
type TbfRunnerObj = class(TObject)
private
fSelectionId : int64 ;
fHandicap : double ;
fRunnerStatus : TbfngRunnerStatus ;
fAdjustmentFactor : double ;
fLastPriceMatched : double ;
fTotalMatched : double ;
fRemovalDate : TDateTime ;
fSPPrices : TbfStartingPricesObj ;
fExchangePrices : TbfExchangePricesObj ;
public
constructor Create ;
destructor Destroy ; override ;
var
aOrders : ArrayOfTbfOrderObj ;
aMatches : ArrayOfTbfMatchObj ;
property iSelectionId : int64 read fSelectionId write fSelectionId ;
property rHandicap : double read fHandicap write fHandicap ;
property eRunnerStatus : TbfngRunnerStatus read fRunnerStatus write fRunnerStatus ;
property rAdjustmentFactor : double read fAdjustmentFactor write fAdjustmentFactor ;
property rLastPriceMatched : double read fLastPriceMatched write fLastPriceMatched ;
property rTotalMatched : double read fTotalMatched write fTotalMatched ;
property dRemovalDate : TDateTime read fRemovalDate write fRemovalDate ;
property oSPPrices : TbfStartingPricesObj read fSPPrices write fSPPrices ;
property oExchangePrices : TbfExchangePricesObj read fExchangePrices write fExchangePrices ;
end ;
type ArrayOfTbfRunnerObj = array of TbfRunnerObj ;
{*************************************************************}
{ Class structure for holding a MarketBook. }
{*************************************************************}
type TbfMarketBookObj = class(TObject)
private
fMarketId : string ;
fIsMarketDataDelayed : boolean ;
fMarketStatus : TbfngMarketStatus ;
fBetDelay : integer ;
fBSPReconciled : boolean ;
fComplete : boolean ;
fInPlay : boolean ;
fNoOfWinners : integer ;
fNoOfRunners : integer ;
fNoOfActiveRunners : integer ;
fLastMatchTime : TDateTime ;
fTotalMatched : double ;
fTotalAvailable : double ;
fCrossMatching : boolean ;
fRunnersVoidable : boolean ;
fVersion : int64 ;
public
constructor Create ;
destructor Destroy ; override ;
var
aRunners : ArrayOfTbfRunnerObj ;
property sMarketId : string read fMarketId write fMarketId ;
property bIsMarketDataDelayed : boolean read fIsMarketDataDelayed write fIsMarketDataDelayed ;
property eMarketStatus : TbfngMarketStatus read fMarketStatus write fMarketStatus ;
property iBetDelay : integer read fBetDelay write fBetDelay ;
property bBSPReconciled : boolean read fBSPReconciled write fBSPReconciled ;
property bComplete : boolean read fComplete write fComplete ;
property bInPlay : boolean read fInPlay write fInPlay ;
property iNoOfWinners : integer read fNoOfWinners write fNoOfWinners ;
property iNoOfRunners : integer read fNoOfRunners write fNoOfRunners ;
property iNoOfActiveRunners : integer read fNoOfActiveRunners write fNoOfActiveRunners ;
property dLastMatchTime : TDateTime read fLastMatchTime write fLastMatchTime ;
property rTotalMatched : double read fTotalMatched write fTotalMatched ;
property rTotalAvailable : double read fTotalAvailable write fTotalAvailable ;
property bCrossMatching : boolean read fCrossMatching write fCrossMatching ;
property bRunnersVoidable : boolean read fRunnersVoidable write fRunnersVoidable ;
property iVersion : int64 read fVersion write fVersion ;
end ;
type ArrayOfTbfMarketBookObj = array of TbfMarketBookObj ;
{*************************************************************}
{ Class structure for holding a LimitOrder. }
{*************************************************************}
type TbfLimitOrderObj = class(TObject)
private
fSize : double ;
fPrice : double ;
fPersistenceType : TbfngPersistenceType ;
public
constructor Create ;
destructor Destroy ; override ;
property rSize : double read fSize write fSize ;
property rPrice : double read fPrice write fPrice ;
property ePersistenceType : TbfngPersistenceType read fPersistenceType write fPersistenceType ;
end ;
{*************************************************************}
{ Class structure for holding a LimitOnCloseOrder. }
{*************************************************************}
type TbfLimitOnCloseOrderObj = class(TObject)
private
fLiability : double ;
fPrice : double ;
public
constructor Create ;
destructor Destroy ; override ;
property rLiability : double read fLiability write fLiability ;
property rPrice : double read fPrice write fPrice ;
end ;
{*************************************************************}
{ Class structure for holding a MarketOnCloseOrder. }
{*************************************************************}
type TbfMarketOnCloseOrderObj = class(TObject)
private
fLiability : double ;
public
constructor Create ;
destructor Destroy ; override ;
property rLiability : double read fLiability write fLiability ;
end ;
{*************************************************************}
{ Class structure for holding a PlaceInstruction. }
{*************************************************************}
type TbfPlaceInstructionObj = class(TObject)
private
fOrderType : TbfngOrderType ;
fSelectionId : int64 ;
fHandicap : double ;
fSide : TbfngSide ;
fLimitOrder : TbfLimitOrderObj ;
fLimitOnCloseOrder : TbfLimitOnCloseOrderObj ;
fMarketOnCloseOrder : TbfMarketOnCloseOrderObj ;
public
constructor Create ;
destructor Destroy ; override ;
property eOrderType : TbfngOrderType read fOrderType write fOrderType ;
property iSelectionId : int64 read fSelectionId write fSelectionId ;
property rHandicap : double read fHandicap write fHandicap ;
property eSide : TbfngSide read fSide write fSide ;
property oLimitOrder : TbfLimitOrderObj read fLimitOrder write fLimitOrder ;
property oLimitOnCloseOrder : TbfLimitOnCloseOrderObj read fLimitOnCloseOrder write fLimitOnCloseOrder ;
property oMarketOnCloseOrder : TbfMarketOnCloseOrderObj read fMarketOnCloseOrder write fMarketOnCloseOrder ;
end ;
type ArrayOfTbfPlaceInstructionObj = array of TbfPlaceInstructionObj ;
{*************************************************************}
{ Class structure for holding a PlaceInstructionReport. }
{*************************************************************}
type TbfPlaceInstructionReportObj = class(TObject)
private
fStatus : TbfngInstructionReportStatus ;
fErrorCode : TbfngInstructionReportErrorCode ;
fInstruction : TbfPlaceInstructionObj ;
fBetId : string ;
fPlacedDate : TDateTime ;
fAveragePriceMatched : double ;
fSizeMatched : double ;
public
constructor Create ;
destructor Destroy ; override ;
property eStatus : TbfngInstructionReportStatus read fStatus write fStatus ;
property eErrorCode : TbfngInstructionReportErrorCode read fErrorCode write fErrorCode ;
property oInstruction : TbfPlaceInstructionObj read fInstruction write fInstruction ;
property sBetId : string read fBetId write fBetId ;
property dPlacedDate : TDateTime read fPlacedDate write fPlacedDate ;
property rAveragePriceMatched : double read fAveragePriceMatched write fAveragePriceMatched ;
property rSizeMatched : double read fSizeMatched write fSizeMatched ;
end ;
type ArrayOfTbfPlaceInstructionReportObj = array of TbfPlaceInstructionReportObj ;
{*************************************************************}
{ Class structure for holding a CancelInstruction. }
{*************************************************************}
type TbfCancelInstructionObj = class(TObject)
private
fBetId : string ;
fSizeReduction : double ; {This value represents how much of the stake to cancel. So if current is £3 and SizeReduction=2 then £1 will remain as the stake.}
public
constructor Create ;
destructor Destroy ; override ;
property sBetId : string read fBetId write fBetId ;
property rSizeReduction : double read fSizeReduction write fSizeReduction ;
end ;
type ArrayOfTbfCancelInstructionObj = array of TbfCancelInstructionObj ;
{*************************************************************}
{ Class structure for holding a CancelInstructionReport. }
{*************************************************************}
type TbfCancelInstructionReportObj = class(TObject)
private
fStatus : TbfngInstructionReportStatus ;
fErrorCode : TbfngInstructionReportErrorCode ;
fInstruction : TbfCancelInstructionObj ;
fSizeCancelled : double ;
fCancelledDate : TDateTime ;
public
constructor Create ;