I need help with writing a vb. code for a market making algorithm that shall run on Rotman Interactive Trader. The security is called OGO.
Rules are :
- Create a VBA function to trade algorithmically. Function to run once per second.
- Function should cancel any open orders.
- Function should then submit two limit orders, one to buy and one tosell.
- limit your exposure, either by reducing your tradingvolume as your position increases, or adjusting your spread.
5. Mmax trade size is 6000 shares. Yourposition limit is ±35000shares. You will not be able to exceed this limit. Tradingcommissions are $0.01, but you get a $0.005 rebate for submitting limit orders(providing liquidity to the market).
This is what I have so far. Some things are missing and others may not be correct and I am not sure how to finish the algorithm vb code.
OptionExplicit
Function MarketMaking(timeRemaining As Integer) As String
'Declare the Rotman API
Dim Trader As RIT2.API
Set Trader = New RIT2.API
Dim status As Variant 'Needed to place orders
MarketMaking = "Have 2 Orders"
If Range("B6").Value <> 2 Then
'Cancel my open orders
Trader.CancelOrderExpr ("Price>0")
'All orders have price > 0
status = Trader.AddOrder("OGO", 1000, Range("D4").Value - 0.05, Trader.BUY, Trader.LMT)
status = Trader.AddOrder("OGO", 1000, Range("D4").Value + 0.05, Trader.SELL, Trader.LMT)
MarketMaking = "Placed 2 Orders"
End If
End Function