Skip to main content

Version Upgrade Guide

This document will guide you through upgrading your existing FubonNeo API version 1.0.4 to the latest version 1.3.1

Main differences

C# CallBack Subscription

v1.0.4 callback

public class MyCallback : Callback
{
public string code ="";
public string response = "";

//Callback to receive order data
public void OnOrder(string code, OrderResult data)
{
if(data != null)
{
response = data.ToString();
Console.WriteLine("On Order" + response);
}

}

//Callback to receive Modified data
public void OnOrderChanged(string code, OrderResult data)
{
if(data != null)
{
response = data.ToString();

Console.WriteLine(code);
Console.WriteLine("Modified" + response);
}

}

//Callback to receive Filled data
public void OnFilled(string code, FilledData data)
{
if(data != null)
{
response = data.ToString();

Console.WriteLine(code);
Console.WriteLine("Filled" + response);
}

}

//Callback to receive Event data
public void OnEvent(String code, String data)
{
response = data.ToString();
Console.WriteLine(code);
Console.WriteLine("Event" + response);
}
}

var callback = new MyCallback();
sdk.RegisterCallback(callback);

Use the new subscription method

With this update, a new subscription method has been released. Subscribe using the following method The new method allows subscription based on the desired category, eliminating the need to implement every method individually.


sdk.OnEvent += (code, msg) =>
{
Console.WriteLine(code + msg );
};

// Stock

sdk.OnOrder += (code, ordeResult) =>
{
Console.WriteLine(code + ordeResult.ToString());
};

sdk.OnOrderChanged += (code, ordeResult) =>
{
Console.WriteLine(code + ordeResult.ToString());
};

sdk.OnFilled += (code, filledData) =>
{
Console.WriteLine(code + filledData.ToString());
};

// Future

sdk.OnFutoptOrder += (code, FutOptOrderResult) =>
{
Console.WriteLine(code + FutOptOrderResult.ToString());
};

sdk.OnFutoptOrderChanged += (code, FutOptOrderResult) =>
{
Console.WriteLine(code + FutOptOrderResult.ToString());
};

sdk.OnFutoptFilled += (code, FutOptFilledData) =>
{
Console.WriteLine(code + FutOptFilledData.ToString());
};