Author Topic: Counting markets refreshed in the last minute  (Read 2729 times)

Tags:
  • All members
  • Posts: 211
Counting markets refreshed in the last minute
« on: 28 Oct 2020, 22:44 »
Hi,


I would like to count the number of different markets that were refreshed in the last minute.

Giving the timeline where the present is "n"


(n-60)...............(n-50)............(n)............(n+10)

In the present moment "n", i would like it to count the markets refreshed since "n-60". When it goes foward and we are in "n+10" it should count from n-50 to n+10 and so on.

So, the intention is to count always the number of individual markets refreshed in the last 60 seconds.

Is it even possible?

Thanks

  • Administrator
  • Posts: 8821
  • Gender: Female
*
Re: Counting markets refreshed in the last minute
« Reply #1 on: 29 Oct 2020, 12:23 »
Hello!

This sounds like a non-trivial task, as you would need to keep in memory a FIFO sequence of market refreshes over the last 60 seconds, and MF Pro unfortunately is not a full-fledged programming language, so it doesn't support arrays.

But there is a built-in variable for the total number of refresh requests to BetFair, all markets included, will that suffice?
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 211
Re: Counting markets refreshed in the last minute
« Reply #2 on: 29 Oct 2020, 14:59 »
But there is a built-in variable for the total number of refresh requests to BetFair, all markets included, will that suffice?

Hi Oxa,

I would say it may give a good approximation as long the information is by instance. I´ve several instances running simultaneously. so, in this case, i would need the number of refresh requested per each instance of MFPro.

Thanks

  • All members
  • Posts: 211
Re: Counting markets refreshed in the last minute
« Reply #3 on: 30 Oct 2020, 15:20 »
But there is a built-in variable for the total number of refresh requests to BetFair, all markets included, will that suffice?

Hi Oxa,

Can you, please, tell me what´s the built-in variable? I tried to find it but i wasn´t able.


Thanks

  • Administrator
  • Posts: 8821
  • Gender: Female
*
Re: Counting markets refreshed in the last minute
« Reply #4 on: 30 Oct 2020, 15:33 »
For an average number of market refresh requests over the last minute, use mntr_avg_mreqs.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • Moderator
  • Posts: 3597
*
Re: Counting markets refreshed in the last minute
« Reply #5 on: 30 Oct 2020, 17:10 »
Hi
Also if you are looking for a count of markets that are currently being refreshed it is: refr_market_num
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 211
Re: Counting markets refreshed in the last minute
« Reply #6 on: 30 Oct 2020, 17:42 »
Hi Also if you are looking for a count of markets that are currently being refreshed it is: refr_market_num

Hi MarkV,

I already use refr_market_num, but as i have several refresh rates the information it provides me is far from ideal. Something that would give me the number of events being refreshed would be much closer to what i need.

Anyway, i am testing mntr_avg_mreqs, hopefully it can be useful for my purposes.


Thanks

  • All members
  • Posts: 211
Re: Counting markets refreshed in the last minute
« Reply #7 on: 30 Oct 2020, 23:18 »
Oxa, i am struggling to understand exactly what this variable measures. I explain better: i tested it using 1 market and several refresh rates. I am going to list it followed by the result obtained:

refresh rate       mntr_avg_mreqs

1

  • All members
  • Posts: 211
Re: Counting markets refreshed in the last minute
« Reply #8 on: 30 Oct 2020, 23:41 »
Sorry, for some reason it seems i clicked on post before my post was finished. So here it goes as it should be:

Oxa, i am struggling to understand exactly what this variable measures. I explain better: i tested it using 1 market with different refresh rates. I am going to list it followed by the result obtained:

refresh rate in secs         mntr_avg_mreqs

    1                                        89
    10                                       24
    60                                      18

I was expecting that the ratio between the value of the variables when the refresh rate is 1 compared with 10 would be around 10 and compared with 60 would be 60. So, i was expecting that when using 1 refresh per second i had 10 and 60 times more requests respectively.

As it is not even near, i am, obviously, not understanding the meaning of the variable. Do you know how is it calculated?


Thanks

  • Administrator
  • Posts: 8821
  • Gender: Female
*
Re: Counting markets refreshed in the last minute
« Reply #9 on: 01 Nov 2020, 14:27 »
Yes, you're right, I've looked into the code and found out that the variable counts all non-transactional requests to BetFair, including your statement, available funds, keep-alive, etc.

There is no dedicated variable specifically for the number of markets refreshed.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 211
Re: Counting markets refreshed in the last minute
« Reply #10 on: 15 Dec 2020, 02:56 »
Hi,

I've found a solution i would like to share with the community. It's far from perfect but it seems to do what it's supposed. To count the number of refreshed markets on a certain period of time.

You can decide if you wanna chose a certain rate, or just the total. You can change, as well, the period of time to something different from 1 minute.

The total number of refreshed markets is given by the variable "MktNum".

:):):)

  • All members
  • Posts: 211
Re: Counting markets refreshed in the last minute
« Reply #11 on: 15 Dec 2020, 03:43 »
There was an error with the close blocks. When i copied it to the file they both assumed "unknown market". I send you, now, an, already corrected, version of the trigger.

  • Administrator
  • Posts: 8821
  • Gender: Female
*
Re: Counting markets refreshed in the last minute
« Reply #12 on: 15 Dec 2020, 16:20 »
Great, thank you for sharing this BlueSky, I'm glad that you found your solution.

What is this the condition for?

Selection's Trigger Expression (now_time/mf_minute-INTEGER(now_time/mf_minute))*60 is between 6 and 54
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 211
Re: Counting markets refreshed in the last minute
« Reply #13 on: 15 Dec 2020, 17:08 »
Hi Oxa,

(now_time/mf_minute-INTEGER(now_time/mf_minute))*60 is a clock that gives you periods of 60 seconds. This way, as you are using the internal MFPro clock, you know that you are always closing the block at exact intervals, independently of the market that does it.

Let me try to explain the principle of the trigger, perhaps it's easier.

The main problem was that you would need to restart the counting and that would make the number go to zero. So, the solution i found was to establish 2 counting periods:

-One from 0-24 and 36 to 60 (36 to 24) zeroing between 25 and 35.
-the other one from 6 to 54 zeroing between (55 and 5).

So, when the Close block zeroes one, you will use the number of the other. ;);););)






  • Administrator
  • Posts: 8821
  • Gender: Female
*
Re: Counting markets refreshed in the last minute
« Reply #14 on: 29 Dec 2020, 16:47 »
Right, this sounds very intricate.

Perhaps, I should introduce more means of controlling the number of refreshed markets after all.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

 

Please note, BetFair is seems to be currently OFFLINE