Skip to content

ErrorCode

Summary

Enumeration of standard error codes.

Remarks

Error codes are readable descriptions of the responses returned by the server.

Signature

1
public enum ErrorCode

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 protected override void OnError(Error error)
 {
     //  Print the error to the log
     switch (error.Code)
     {
             case ErrorCode.BadVolume: Print("Bad Volume");
             break;
             case ErrorCode.TechnicalError:Print("Technical Error");
             break;
             case ErrorCode.NoMoney: Print("No Money");
             break;
             case ErrorCode.Disconnected: Print("Disconnected");
             break;
             case ErrorCode.MarketClosed: Print("Market Closed");
             break;
     }
 }

Fields

TechnicalError

Summary

A generic technical error with a trade request.

Signature

1
public static ErrorCode TechnicalError;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.TechnicalError)
     {
         Print("Error. Confirm that the trade command parameters are valid");
     }
 }

BadVolume

Summary

The volume value is not valid

Signature

1
public static ErrorCode BadVolume;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.BadVolume)
     {
         Print("Invalid Volume amount");
     }
 }

NoMoney

Summary

There are not enough money in the account to trade with.

Signature

1
public static ErrorCode NoMoney;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.NoMoney)
     {
         Print("Not enough money to trade.");
     }
 }

MarketClosed

Summary

The market is closed.

Signature

1
public static ErrorCode MarketClosed;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.MarketClosed)
     {
         Print("The market is closed.");
     }
 }

Disconnected

Summary

The server is disconnected.

Signature

1
public static ErrorCode Disconnected;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.Disconnected)
     {
         Print("The server is disconnected.");
     }
 }

EntityNotFound

Summary

Position does not exist.

Signature

1
public static ErrorCode EntityNotFound;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.EntityNotFound)
     {
         Print("Position not found");
     }
 }

Timeout

Summary

Operation timed out.

Signature

1
public static ErrorCode Timeout;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.Timeout)
     {
         Print("Operation timed out");
     }
 }

UnknownSymbol

Summary

Unknown symbol.

Signature

1
public static ErrorCode UnknownSymbol;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.UnknownSymbol)
     {
         Print("Unknown symbol.");
     }
 }

InvalidStopLossTakeProfit

Summary

The invalid Stop Loss or Take Profit.

Signature

1
public static ErrorCode InvalidStopLossTakeProfit;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.InvalidStopLossTakeProfit)
     {
         Print("The invalid Stop Loss or Take Profit.");
     }
 }

InvalidRequest

Summary

The invalid request.

Signature

1
public static ErrorCode InvalidRequest;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.InvalidRequest)
     {
         Print("The invalid request.");
     }
 }

NoTradingPermission

Summary

Occurs when accessing trading API without trading permission.

Signature

1
public static ErrorCode NoTradingPermission;

Return Value

ErrorCode

Examples

1
2
3
4
5
6
7
 protected override void OnError(Error error)
 {
     if (error.Code == ErrorCode.NoTradingPermission)
     {
         Print("The invalid request.");
     }
 }