Step 1: read the API docs.
Step 2: write an API client
Step 3: Connect to a level
Step 4: Lose loads of money
Step 5: ???
Step 6: Profit!
Note: I have not actually achieved step 6, but I blame a detour into learning C++ and wrapping a websocket client in R.