The 'decade of international law' (GA Res 45/90) has come and gone and the international community has entered the 21st century. At the start of the 1990s, the end of the 'cold war' brought uncertainty but actually heralded a new era of cooperation
The nature of international law and the international system
among the five permanent members of the Security Council and a consequential increase in the influence of the United Nations. The present decade is unlikely to witness such a fundamental realignment, but the challenges facing international law are no less pressing.
The next few years will see the wider exercise of jurisdiction by the International Criminal Court and, no doubt, a widening of the scope of international law to embrace in even more detail non-state entities such as individuals, organisations and corporations. This is nothing new, but perhaps the pace of this development will gather speed. Likewise, to give but a few examples, there will be significant advances in international environmental law, in the law of international communications and more treaty codification of customary law. In the United Nations itself, calls for the abolition of the 'veto' and/or an increase in the number of permanent members of the Security Council are becoming louder and more persistent. In contrast, many international lawyers believe that 'regionalisation' will replace 'universality' as the most effective template for managing the international community. So, perhaps, there will be different rules of international law for Europe, and Africa or North America. Certainly, regional organisations seem more prepared to take on the task of regulating the conduct of its members rather than submit to 'outside' regulation. There is uncertainty, but the world is changing and international law must change with it.
All this will have an impact on a system of law that was conceived originally as a set of rules to govern sovereign states in their international relations. Of course, it remains true that the majority of concrete rules of international law are created by states for states and that conceptions of 'sovereignty' and independence are deeply rooted in the fabric of international society. Nevertheless, it seems that the institutions of international law are changing, and will have to change further, to accommodate the slow but steady move to rules aimed at controlling states (even in their dealings with their own nationals inside their own territory) instead of rules which simply facilitate their interaction. Much will depend on how international law copes with the issue of effective enforcement. A set of rules that facilitates interaction between states without over-prescribing a particular course of action can survive with little or weak enforcement machinery. A set of rules that seeks to control states in their actions needs a stronger enforcement mechanism if it is to achieve its goals. Is this likely, or will the attempt fail and bring the whole edifice of international law into disrepute?
Step 20. Monitoring Bet Status
Having placed a bet you will no doubt be keen to know if and when the bet is matched. This can be done by calling getMUBets at regular time intervals (e.g. 1 sec) .
If you look in the API Guide you will see that many of the request parameters are used to control the way that data is returned if you have a large number of bets on a market. To keep things simple we won’t worry about these for the time being. We simply set .marketId to return all bets on the current market.
Add this sub to the Testform class:
Code:
Private Sub GetBetStatus(ByVal YourMarket As Integer)
Dim Req As New BFUK.GetMUBetsReq
With Req
.header = oHeaderUK() 'The standard header
.marketId = YourMarket 'The market of interest
.betStatus = BFUK.BetStatusEnum.MU 'Return status of matched and unmatched bets
.recordCount = 100 'Max 100 bets
End With
StateCount += 1
BetFairUK.getMUBetsAsync(Req, StateCount) 'Send the request to the API
End Sub
Because a typical application will call getMUBets frequently, we make this an async call to maintain efficiency (as discussed in Step 10). The additional request parameters are unassigned and will default to appropriate values, except for .recordCount which we set to a number greater than the maximum number of bets we are likely to have on a market.
Also add the code for the response event handler:
Code:
Private Sub BetFairUK_getMUBetsCompleted(ByVal sender As Object, ByVal e As BFUK.getMUBetsCompletedEventArgs) Handles BetFairUK.getMUBetsCompleted
Try
If Not e.Cancelled Then
With e.Result
CheckHeader(.header)
Print("ErrorCode = " & .errorCode.ToString)
If .errorCode = BFUK.GetMUBetsErrorEnum.OK Then
For i = 0 To .bets.Length - 1 'For all bets on the market
To test this add a “BetStatus” button to the TestForm. Name it bBetStatus and add this code for its Click event handler:
Code:
Private Sub bBetStatus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bBetStatus.Click
Print("*** GetBetStatus ***")
GetBetStatus(Market) 'Call getMUBets
End Sub
Market is the variable we added in Step 19.
Now log onto the website and go to your market of interest. Set up another test bet as described in Step 19 and run the project. When you click the “BetStatus” button you will get the NO_RESULTS message (assuming you have no bets on the market). Now click the “PlaceBet” button to place the test bet. This bet should appear on the “My Bets” tab on the website.
Now click the “BetStatus” button again. The parameters for this bet (.betId, .betStatus, .price and .size) will now be printed and should agree with the website. Several other parameters of interest are returned too (see the API Guide).
You can experiment with this by changing the odds and the stake on the website and observing what is printed when you click “BetStatus”. If you wish, cancel or match the bet.
A practical application will probably won’t have a “BetStatus” button. Instead getMUbets could be called from the Tick event of a “refresh” timer or similar.
A partially-matched bet will be returned as 2 bets with the same betId. The data for each part (.status, .size, .price, etc.) will be given in a separate element in the .bets array
As an alternative, you can call getBet to return data for a single bet in more detail. However, for a quick look at all your bets on a market, a call to getMUbets should suffice.