this.Symbols.GetSymbols()

Created at 09 Feb 2023, 21:12
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!
CT

ctid5752082

Joined 09.02.2023

this.Symbols.GetSymbols()
09 Feb 2023, 21:12


Good Morning,

 

I am trying to code some code, using

- 'cTrader 4.5.9'

- '.NET6.0'

 

I am using the function 'this.Symbols.GetSymbols()'.

 

My (abbreviated) code is -

 

string[] xSymbolsA;

cAlgo.API.Internals.Symbol[] xSymbolsX;



xSymbolsA = (this.Symbols.ToArray());

xSymbolsX = (this.Symbols.GetSymbols(xSymbolsA));



This produces either a 'timeout', or an incomplete list of 'symbols', where some of the 'symbols' return have 'null' value.

When 'null' values are returned, there is a message in the 'Log' section of the 'cTrader Desktop' application stating -

 

"09/02/2023 18:37:49.329 | Failed to get symbol 'USDCHF': Symbol not found or has no quotes."

 

Recently, last Tuesday (20230207), there was an update to 'cTrader 4.5.9'.  I am not sure of the previous version number.

 

This code worked on the previous version of 'Ctrader'.

 

What is the issue here?

 

 

 

Thank you for your time,

 


@ctid5752082
Replies

PanagiotisChar
10 Feb 2023, 10:05

Hi there,

Better share a complete cBot code so that we can try to reproduce.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar

ctid5752082
10 Feb 2023, 13:41

PanagiotisChar said:

Hi there,

Better share a complete cBot code so that we can try to reproduce.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Thank you for your reply.

 

Here is some example code -

 

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 sdfdsfdsf : Robot
    {
        protected override void OnStart()
        {
            System.Diagnostics.Debugger.Launch();

            string[] xSymbolsA;
            cAlgo.API.Internals.Symbol[] xSymbolsX;

            xSymbolsA = (this.Symbols.ToArray());
            xSymbolsX = (this.Symbols.GetSymbols(xSymbolsA));

            xSymbolsX = (xSymbolsX);

            this.Stop();
        }

        protected override void OnTick()
        {
            // Handle price updates here
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}

The code either times out, or produces a bunch of 'Log' 'Error' messages similar to -

 

"10/02/2023 11:40:37.568 | Failed to get symbol 'USDCHF': Symbol not found or has no quotes."

 

This happens for pretty much all symbols.

 

Thank you for your time,

 

 

 


@ctid5752082

ctid5752082
10 Feb 2023, 14:53

An update -

 

I installed the latest 'cTrader' 'Desktop' (4.6.3.13401), direct from the ctrader.com website.

I previously was using my broker 'cTrader' download (4.5.9).  I didn't realize that I could use the 'non broker' 'cTrader'.

 

Anyway, I now get an 'error' 'pop up' window, as follows -

#Exception #6E789BB3 in cTrader 4.6.3.13401

An error has occurred.  The problem has been submitted to the cTrader team.  We apologize for the inconvenience.  Please restart cTrader.

If run through 'debugger' in 'VS2022', I get an 'Exception User-Unhandled' error, with the details -

cTrader.Automate.Host.Dispatcher.Exceptions.AutomateDispatcherAbortException
  HResult=0x80131500
  Message=Exception_WasThrown
  Source=cTrader.Automate.Host
  StackTrace:
   at cTrader.Automate.Host.Dispatcher.AutomateTargetDispatcher.InvokeLoopCycle(AutomateTargetDispatcherLoopMethods methods)
   at cTrader.Automate.Host.Dispatcher.AutomateTargetDispatcher.NestedLoop(AutomateTargetDispatcherLoopMethods methods, CancellationToken cancellationToken)
   at cTrader.Automate.Host.Router.AutomateTargetRouter.Wait[TMessage](Predicate`1 predicate, AutomateTargetDispatcherLoopMethods dispatcherLoopMethods)
   at cTrader.Automate.Host.Router.AutomateTargetRouter.Wait[TMessage](Predicate`1 predicate)
   at cTrader.Automate.Host.Router.AutomateTargetRouter.SendAndWait[TMessage](IAutomateMessage message, Predicate`1 predicate)
   at cTrader.Automate.Host.Router.AutomateTargetRouter.SendAndWait[TMessage](IAutomateMessage message)
   at cTrader.Automate.Host.Runtime.Controllers.Symbol.SmallSymbolSubscriptionController.TrySubscribe(SymbolName symbolName, Nullable`1& symbolQuoteDto)
   at cTrader.Automate.Host.Runtime.Api.Symbol.SmallSymbols.TrySubscribeSymbol(SymbolName symbolName)
   at cTrader.Automate.Host.Runtime.Api.Symbol.SmallSymbols.TrySubscribeSymbol(SymbolName symbolName, ISmallSymbol& smallSymbol, Nullable`1& errorCode)
   at cTrader.Automate.Host.Runtime.Api.Symbol.SmallSymbols.GetSymbol(SymbolName symbolName)
   at cTrader.Automate.Host.Runtime.Api.Asset.SmallAssetConverter.<GetOrCreateExchanger>b__12_0(SymbolName n)
   at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
   at cTrader.Automate.Host.Runtime.Api.Asset.SmallExchangerFactory.Create(String from, IEnumerable`1 symbols)
   at cTrader.Automate.Host.Runtime.Api.Asset.SmallAssetConverter.GetOrCreateExchanger(String from, String to)
   at cTrader.Automate.Host.Runtime.Api.Asset.SmallAssetConverter.ConvertToDeposit(Decimal value, String fromAssetName)
   at cTrader.Automate.Host.Runtime.Api.Symbol.SmallSymbols.UpdateSymbolQuoteToDepositConversionRate(ISmallSymbol smallSymbol)
   at cTrader.Automate.Host.Runtime.Api.Symbol.SmallSymbols.OnBeforeSymbolTick(SymbolQuoteDto symbolQuoteDto)
   at cTrader.Automate.Host.Runtime.Controllers.Symbol.SmallSymbolSubscriptionController.cTrader.Automate.Domain.Shared.Messaging.IAutomateMessageHandler<cTrader.Automate.Domain.Shared.SymbolApi.SymbolQuoteTickMessage>.Handle(SymbolQuoteTickMessage message)
   at cTrader.Automate.Host.Dispatcher.AutomateTargetDispatcher.TryInvokeThreadSafeAction()
   at cTrader.Automate.Host.Dispatcher.AutomateTargetDispatcher.InvokeLoopCycle(AutomateTargetDispatcherLoopMethods methods)
   at cTrader.Automate.Host.Dispatcher.AutomateTargetDispatcher.NestedLoop(AutomateTargetDispatcherLoopMethods methods, CancellationToken cancellationToken)
   at cTrader.Automate.Host.Router.AutomateTargetRouter.Wait[TMessage](Predicate`1 predicate, AutomateTargetDispatcherLoopMethods dispatcherLoopMethods)
   at cTrader.Automate.Host.Router.AutomateTargetRouter.Wait[TMessage](Predicate`1 predicate)
   at cTrader.Automate.Host.Router.AutomateTargetRouter.SendAndWait[TMessage](IAutomateMessage message, Predicate`1 predicate)
   at cTrader.Automate.Host.Router.AutomateTargetRouter.SendAndWait[TMessage](IAutomateMessage message)
   at cTrader.Automate.Host.Runtime.Controllers.Symbol.SmallSymbolSubscriptionController.SubscribeAvailable(SymbolName[] symbolNames)
   at cTrader.Automate.Host.Runtime.Api.Symbol.SmallSymbols.TrySubscribeSymbols(HashSet`1 symbolNames)
   at cTrader.Automate.Host.Runtime.Api.Symbol.SmallSymbols.GetSymbols(SymbolName[] symbolNames)
   at cTrader.Automate.Adapters.SymbolApi.SymbolsAdapter.GetSymbols(String[] symbolNames)
   at cAlgo.Robots.sdfdsfdsf.OnStart() in C:\Users\xyz\Documents\cAlgo\Sources\Robots\sdfdsfdsf\sdfdsfdsf\sdfdsfdsf.cs:line 24
   at cTrader.Automate.Adapters.RobotWrapper.OnStart()
   at cTrader.Automate.Host.Runtime.Instances.SmallRobotInstance.<.ctor>b__6_2()
   at cTrader.Automate.Host.Runtime.AlgoExecutor.SmallAlgoCodeExecutorExtensions.<>c.<.cctor>b__3_0(Action a)
   at cTrader.Automate.Domain.Shared.Dispatcher.DispatcherAction.DispatcherActionImpl`1.Invoke()
   at cTrader.Automate.Host.Runtime.AlgoExecutor.SmallAlgoCodeExecutor.ExecuteInternal(IDispatcherAction& action, Boolean raiseFrameEvent)

  This exception was originally thrown at this call stack:
    [External Code]
    cAlgo.Robots.sdfdsfdsf.OnStart() in sdfdsfdsf.cs
    [External Code]

 

I don't know if that helps with understanding the situation.

 

Thank you for your time,

 


@ctid5752082

ctid5625354
09 Jun 2023, 14:03

RE:

Hi there,

 

I'm having similar problems with the MarketData.GetBars() Method. Currently running Version 4.6.7., where I get an Error

 

Failed to get symbol 'CADCHF': Symbol not found or has no quotes

 

for all symbols (CADCHF was just an example), except the symbol that is set in the bot options. I don't know exactly since when it doesn't work anymore, but a few weeks ago I had no such problem and everything worked well.

My broker is FxPro.

 

Best,

 


@ctid5625354

... Deleted by UFO ...