我想从https://github.com/simplefx-ltd/simplefx-api得到以下工作
Request:
{
"H":"quotessubscribehub",
"M":"getLastPrices",
"A":[["BTCUSD","LTCUSD","ETHUSD","TLRY.US","GWPH.US"]],
"I":0
}
hub - quotessubscribehub
method - getLastPrices
arguments:
0 - list of instruments - ["BTCUSD","LTCUSD","ETHUSD","TLRY.US","GWPH.US"]
我在c#中的第一次尝试如下:
[Command]
public async void LiveTrades()
{
var trades = new List<String>() { "BTCUSD", "LTCBTC" };
var hubConnection = new HubConnection("https://webquotes-v3.simplefx.com/signalr/");
IHubProxy stockTickerHubProxy = hubConnection.CreateHubProxy("quotessubscribehub");
hubConnection.Headers.Add("H", "quotessubscribehub");
hubConnection.Headers.Add("M", "getLastPrices");
hubConnection.Headers.Add("A", trades.ToString());
hubConnection.Headers.Add("I", "0");
stockTickerHubProxy.On<LiveSymbols>("getLastPrices", stock => TradePrice = stock.R.Data.ToString());
await hubConnection.Start();
}
我不是100%,但也许参数列表导致我的主要问题。任何帮助都将被感激地接受。非常感谢斯科特
**编辑:看起来我现在有正确的文书清单。
var trades = new List<String>() { "BTCUSD", "LTCBTC" };
string output = new JavaScriptSerializer().Serialize(trades);
返回[“BTCUSD”,“LTCBTC”]
连接似乎很好,但没有向我返回任何项目。会继续努力
这解决了它。
var trades = new List<String>() { "BTCUSD", "LTCBTC" };
await hubConnection.Start();
var returnValue = await stockTickerHubProxy.Invoke<R>("getLastPrices", trades);