Getting data by "Symbols.GetSymbol" suddenly became very slow?

Created at 04 Apr 2023, 16:03
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
WH

whaaaaatever.ken

Joined 12.02.2021

Getting data by "Symbols.GetSymbol" suddenly became very slow?
04 Apr 2023, 16:03


The optimization of the cbot with it takes over an hour what used to take about 5 minutes.

Is it just my environment?


@whaaaaatever.ken
Replies

Spotware
05 Apr 2023, 09:38

Dear trader,

Can you please share with us your cBot code so that we can reproduce the behavior? Also please let us know which versions you are comparing.

Best regards,

cTrader Team


@Spotware

whaaaaatever.ken
05 Apr 2023, 16:53

RE:

Spotware said:

Dear trader,

Can you please share with us your cBot code so that we can reproduce the behavior? Also please let us know which versions you are comparing.

Best regards,

cTrader Team

Thank you for your reply.
I have included the cbot code below with only the relevant code extracted.
Please try to optimize by varying Num from 0 to 100.
It will take a very long time.
It did not take as long as it did a month ago.

The version of Ctrader is 4.6.5.

 

//////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot3 : Robot
    {
        [Parameter(DefaultValue = 0, MinValue = 0, MaxValue = 100, Step = 1)]
        public int Num { get; set; }

        protected override void OnStart()
        {
        }

        protected override void OnBar()
        {
            Print(Symbols.GetSymbol("CADJPY").Bid);
        }
    }
}


@whaaaaatever.ken

daniel.podrazka
13 Apr 2023, 11:08 ( Updated at: 13 Apr 2023, 11:16 )

RE: RE: Same issue with MarketData.GetBars

whaaaaatever.ken said:

Spotware said:

Dear trader,

Can you please share with us your cBot code so that we can reproduce the behavior? Also please let us know which versions you are comparing.

Best regards,

cTrader Team

Thank you for your reply.
I have included the cbot code below with only the relevant code extracted.
Please try to optimize by varying Num from 0 to 100.
It will take a very long time.
It did not take as long as it did a month ago.

The version of Ctrader is 4.6.5.

 

//////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot3 : Robot
    {
        [Parameter(DefaultValue = 0, MinValue = 0, MaxValue = 100, Step = 1)]
        public int Num { get; set; }

        protected override void OnStart()
        {
        }

        protected override void OnBar()
        {
            Print(Symbols.GetSymbol("CADJPY").Bid);
        }
    }
}

I have the same issue with MarketData.GetBars. My code is taking around 30 times longer to execute which is a huge problem for me. I tested it on two identical machines, one of them was running 4.5.9 and the other 4.6.6. The 4.6.6 was very slow. I updated the version on the other machine to test if this was causing the problem and it did. Right after update, backtesting slowed down. It worked fine on 4.5.9 but now I cannot downgrade to the old version anymore. Please, provide us with the 4.5.9 version until this issue is fixed.

Here's example code demonstrating the issue:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot3 : Robot
    {
        [Parameter(DefaultValue = 0, MinValue = 0, MaxValue = 100, Step = 1)]
        public int Num { get; set; }
 private Bars _eurUsdBars;
        protected override void OnStart()
        {
          _eurUsdBars = MarketData.GetBars(TimeFrame, "EURUSD");
        }

        protected override void OnBar()
        {
        
               Print("test");
        }
    }
}


@daniel.podrazka

Spotware
13 Apr 2023, 14:47

Dear traders,

Unfortunately we were not able to reproduce the issue. Please provide us with the following information

  1. Symbol and timeframe of the specific instance
  2. Backtesting/Optimization dates
  3. Data source (Tick/m1 Bars/ Instance timeframe bars)

Best regards,

cTrader Team


@Spotware

daniel.podrazka
13 Apr 2023, 16:18

RE:

Spotware said:

Dear traders,

Unfortunately we were not able to reproduce the issue. Please provide us with the following information

  1. Symbol and timeframe of the specific instance
  2. Backtesting/Optimization dates
  3. Data source (Tick/m1 Bars/ Instance timeframe bars)

Best regards,

cTrader Team

  1. Symbol and timeframe of the specific instance: USDPLN, h1
  2. Backtesting/Optimization dates: 23/01/2021 to 12/04/2023
  3. Data source (Tick/m1 Bars/ Instance timeframe bars): m1 bars from Server ( open prices )

Additional info: I tried setting the instance symbol to the same symbol as for MarketData.GetBars and then backtesting worked fast, but any other symbol is slow.

 


@daniel.podrazka

daniel.podrazka
14 Apr 2023, 14:14

Provide 4.5.9 executable

This issue is impeding my work. Please, provide the 4.5.9 version, so I can use it until this issue is resolved. I tried using the 4.1 that is available on cTrader, but 4.1 doesn't work with my bots.


@daniel.podrazka

daniel.podrazka
17 Apr 2023, 22:16

Any Updates?

@Spotware any updates on this? I feel like my request to provide a working version of your software is being ignored which makes me question credibility of your solutions.


@daniel.podrazka

Spotware
18 Apr 2023, 14:20

Dear Daniel,

We are still investigating this issue. Unfortunately 4.5.9 is not available. We will update this thread as soon we have some updates for you.

Best regards,

cTrader Team


@Spotware

daniel.podrazka
18 Apr 2023, 15:27

Video showing the issue

I made a short video that shows the problem (I used the cTrader bot that I posted above). Please observe how the pointer progresses. It looks like there are times when some data is loaded and it progresses quickly for 3 days, and then it slows down again. When I comment out "_eurUsdBars = MarketData.GetBars(TimeFrame, "EURUSD");" Then the bot takes 1 second or less to execute for this period of the last month.

It's some problem related to how the data is stored/cached in the backend for data sources other than the instance symbol. It's like it's trying to load the data again on each minute bar.

 

 


@daniel.podrazka

Spotware
18 Apr 2023, 16:01

Dear Daniel,

Unfortunately we were not able to reproduce the issue internally. Would it be possible to arrange a TeamViewer session to inspect the issue locally? If yes, please contact us at community@ctrader.com to arrange a good date and time.

Best regards,

cTrader Team


@Spotware

daniel.podrazka
18 Apr 2023, 17:42

Dear Spotware Support,

I tested it some more and I found out one more thing that might be useful to fix this problem:

I have two accounts, one account has Euro as the base currency and the other is USD.

When I backtest with Euro, the problem disappears, but with USD it happens. 

 

I can do my backtesting using Euro, so it solves my temporary problem, however it would still be good to address it. Can you try reproducing the bug with base currency set to USD and tell me if you can reproduce it?


@daniel.podrazka

PanagiotisChar
18 Apr 2023, 19:53

Hi Daniel,

Check if this option is checked. If yes, uncheck it and try again.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar

thebeinvest
20 Apr 2023, 10:58 ( Updated at: 20 Apr 2023, 11:06 )

Olá, estou com o mesmo problema. Backtesting lento e otimização do cBot após a atualização do cTrader.

Abri outro tópico pois não tinha visto essa opção.

Também testarei o que Daniel disse sobre usar uma conta EURO apenas para testar e ver se melhora.


Em outras versões meu backtest cBot demorou cerca de 2 horas pelos parâmetros que selecionei, agora o tempo estimado/real passou para mais de 1 dia de espera.

Isso está realmente atrapalhando.

 

As soon as I manage to test the type of EURO/USD account that Daniel mentioned, I'll get back to you if it worked.

In my case, it's even worse, as in version 4.7.7 my cBot doesn't even run optimization on EURAUD asset, and on GBPAUD it only makes 3 trades and crashes.

In version 4.6.6 it is taking more than 1 day in the estimated time to finish the optimization, and previously it took a maximum of 2h.


@thebeinvest

thebeinvest
20 Apr 2023, 11:38 ( Updated at: 21 Dec 2023, 09:23 )

RE:

PanagiotisChar said:

Hi Daniel,

Check if this option is checked. If yes, uncheck it and try again.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

By unchecking this option, I noticed that it was faster (normal, as it was before) but I still haven't concluded the optimization to find out if the trading data is really consistent with what I've been reporting.

But I already advance that what is the function of this checkbox? Will I check or uncheck it affect my optimization results?


@thebeinvest

SmartRetailTradingRobot
20 Apr 2023, 18:27 ( Updated at: 21 Dec 2023, 09:23 )

RE:

PanagiotisChar said:

Hi Daniel,

Check if this option is checked. If yes, uncheck it and try again.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Thank you for the solution of the problem. I had the same issues with every european cfd. With unchecking the box it works again like it should (about 20 times faster).


@SmartRetailTradingRobot