|
Post by ricardorix on Jul 10, 2021 12:21:43 GMT
Hi. I am trying to create a Ipposnif strategy. Short question: Is it possible to call a stored procedure inside a strategy somehow? Long question: I have created a stored procedure called 'p_CreateLogTable'. It works and I can test it via the Ipposnif 'Database Command' feature. The idea is to store data to log tables permanently which can only be done via stored procedure and not functions (an SQL Limitation). So I set up a new strategy and applied the market filter. For the betting timeframe I choose -10 minutes from the start, to 0 minutes from the start, everything good so far! Next I want to run this code, just once at the start. declare @_LogName varchar(MAX);
EXEC dbo.p_CreateLogTable @MarketType = 'test', @InPlay = 1,
@Date = '10-7-2021', @Time = '13:00', @Event = 'Navan', @LogName = @_LogName output;
But, I don't know how or where to try and run this code. I tried to make a bet and put this in the 'trigger condition', but it fails to compile. Any ideas?
|
|
|
Post by ricardorix on Jul 11, 2021 12:25:53 GMT
I'm going to pre-empt a response which which will be no - you can't. Because everything is inside a SQL-function cannot change the state of the DB.
So the reason a stored-procedure or possible just standard SQL Insert\Select\Update queries are required is two-fold. 1. The ability to persist variables to allow more advanced user strategies. 2. The ability to log data at crucial times to help debug and analyse strategies properly.
The strategy model that could be used here is similar to lots of different other scenarios in coding, and is quite simple. It is: 1. Initialise(); -- This is used to initialise variables. 2. Update(); -- This is used every 'tick', in this instance the tick will be every-time the prices change. The user could return FALSE to stop the strategy instance. and that's it.
So this would be needed to just change the 'Betting' aspect of the strategy. No need to change the market filter, runner filter, capital, link to strategy as they all work as they do now.
As a side-note I thought I could perhaps achieve this Initialise() & Update() system by having 2 bets. Initialise() : Bet1 has sql-assertion: (1=1) OR (dbo.stored_procedure_InitMyStrategy(params...)) Update() : Bet2 has update ticked and sql-assertion: dbo.stored_procedure_UpdateMyStrategy(params...) **It is possible to actually do this without the Initialise() if instead you pass say the event name as a parameter and Initialise() whenever that changes.
|
|
|
Post by Ipposnif on Jul 11, 2021 15:16:39 GMT
You cannot call a store procedure within an Ipposnif strategy. The criteria of the strategy can contain only SQL expressions with references to SQL functions or Ipposnif variables. If you want to add a task to the program you need to add it to sp_Main. This store procedure is called in default 120 times per minute.
|
|
|
Post by ricardorix on Jul 11, 2021 23:40:01 GMT
OK, thanks for the info. Not a straight no, so I'm very happy.
Can I ask, is it possible to use any kind of sql statement/function/procedure to trigger a bet that Ipposnif will then pick up on and send an API bet?
|
|
|
Post by Ipposnif on Jul 12, 2021 16:03:27 GMT
No sorry, there isn't. The main reason is that you should provide the Betfair IDs for runners and markets to this procedure. To retrieve them you need to build another program (like Ipposnif). It took me years to get to a stable version that updates markets and places bets in a reliable way. I suggest moving within the Ipposnif "limits", and focus your efforts (and I see your programming capabilities) on developing profitable strategies rather than develop the substrate.
|
|