Skip to content

Robot.OnError

method · Robot · cAlgo.API

DesktopCLICloud

Called if there is an error executing a trade operation.

Definition

protected internal void OnError(Error error)
api.OnError(error: Error) -> None

Parameters

Name C# type Python type Description
error Error Error Error description.

Examples

protected override void OnError(Error error)
{
    Print("Trade error: {0}", error.Code);
    if (error.Code == ErrorCode.NoMoney)
        Stop();
}
def on_error(self, error):
    api.Print(f"Trade error: {error.Code}")
    if error.Code == ErrorCode.NoMoney:
        api.Stop()