Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

respond to ping on LBank trades stream #764

Merged
merged 1 commit into from
Apr 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/ExchangeSharp/API/Exchanges/LBank/ExchangeLBankAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,24 @@ protected override async Task<IWebSocket> OnGetTradesWebSocketAsync(Func<KeyValu
}
else throw new APIException(token["message"].ToStringInvariant());
}
if (token["action"].ToStringInvariant() == "ping")
{/* # ping
{
"action":"ping",
"ping":"0ca8f854-7ba7-4341-9d86-d3327e52804e"
}
# pong
{
"action":"pong",
"pong":"0ca8f854-7ba7-4341-9d86-d3327e52804e"
} */
var pong = new
{
action = "pong",
pong = token["ping"].ToStringInvariant(),
};
await _socket.SendMessageAsync(pong);
}
else if (token["type"].ToStringInvariant() == "trade")
{
var trade = token["trade"].ParseTrade("amount", "price", "direction", "TS", TimestampType.Iso8601China, null);
Expand Down