jkorf / bitfinex.net Goto Github PK
View Code? Open in Web Editor NEWA C# .netstandard client library for the Bitfinex REST and Websocket API focusing on clear usage and models
Home Page: https://jkorf.github.io/Bitfinex.Net/
License: MIT License
A C# .netstandard client library for the Bitfinex REST and Websocket API focusing on clear usage and models
Home Page: https://jkorf.github.io/Bitfinex.Net/
License: MIT License
Not sure if it's meant to be done this way, but I stop the socketClient whe my apps go to sleep and then try to start the client again when it resumes.
When trying to cal Start() again after stopped I get:
System.NullReferenceException
at CryptoExchange.Net.Implementation.BaseSocket.get_IsClosed()
at Bitfinex.Net.BitfinexSocketClient.CheckConnection()
at Bitfinex.Net.BitfinexSocketClient.StartInternal()
at Bitfinex.Net.BitfinexSocketClient.Start()
-----
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__276_1(Object obj)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
I see what
https://api.bitfinex.com/v2/trades/btcusd/hist
returns nothing, but
https://api.bitfinex.com/v1/trades/btcusd
return last 50 trades.
Could you add v1 call instead v2?
Hi, can you please add post-order option for placing order?
https://support.bitfinex.com/hc/en-us/articles/115003507365-Post-Only-Limit-Order-Option
Here's a description on it.
I'm using the BitfinexSocketClient to place an order asynchronously, and it does perform the operation against the API, but it seems to struggle getting confirmation from the Socket API as the call times out with a "No confirmation received for placed order"
Hi,
I'm getting below warning on 1.1
2018-07-18 12:51:13:190 | Warning | Received unknown event type: [
1531910700000,
7387.1,
7396.6,
7396.7,
7387.1,
32.85067643
]
Subscription to candles doesn't work as expected.
On 1.0.19 everything works.
Occasionally getting this exception on place order. Something to do with a dictionary you are using?
2018-06-06 14:56:25:743 | Debug | Received message: [87,"tu",[254599046,1528322020598,0.13307,605.58]]
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Bitfinex.Net.BitfinexSocketClient.<>c__DisplayClass62_0.b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Bitfinex.Net.BitfinexSocketClient.d__62.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
2018-06-06 14:56:25:772 | Debug | Received message: [0,"n",[1528322020814,"on-req",null,null,[13042123129,null,1152813656,"tETHUSD",null,null,0.2778,0.2778,"STOP",null,null,null,null,null,null,null,612.49,null,null,null,null,null,null,0,null,null,null,null,null,null,null,null],null,"SUCCESS","Submitting stop buy order for 0.2778 ETH."]]
2018-06-06 14:56:25:772 | Debug | Received message: [0,"on",[13042123129,null,1152813656,"tETHUSD",1528322020794,1528322020816,0.2778,0.2778,"STOP",null,null,null,0,"ACTIVE",null,null,612.49,0,null,null,null,null,null,0,0,0,null,null,"API>BFX",null,null,null]]
15:36:06.31[32]DEBUG:[bitfinex] Loaded 1 ticks for btcusd:Bitfinex. Last is 260060300
15:36:06.32[32]DEBUG:[bitfinex] Loaded 1 ticks for btcusd:Bitfinex. Last is 260060301
15:36:06.35[32]DEBUG:[bitfinex] Loaded 1 ticks for btcusd:Bitfinex. Last is 260060299
15:36:06.35[32]DEBUG:sec btcusd:Bitfinex mydate 21.06.2018 12:36:06 newdate 21.06.2018 12:36:06 clear 3 trades. findById=True id=260060299 before=801
15:36:06.36[32]DEBUG:[bitfinex] Loaded 1 ticks for btcusd:Bitfinex. Last is 260060301
15:36:06.36[32]DEBUG:[bitfinex] Loaded 1 ticks for btcusd:Bitfinex. Last is 260060300
15:36:06.36[32]DEBUG:sec btcusd:Bitfinex mydate 21.06.2018 12:36:06 newdate 21.06.2018 12:36:06 clear 1 trades. findById=True id=260060300 before=802
2018/06/21 15:36:17:240 | Info | Received status code 20051, going to reconnect the websocket
15:36:17.24[32]DEBUG:[bitfinex] API: 2018/06/21 15:36:17:240 | Info | Received status code 20051, going to reconnect the websocket
2018/06/21 15:36:20:149 | Info | Socket connection established
2018/06/21 15:36:20:150 | Info | Websocket version: 2, platform status: operational
15:36:20.17[13]DEBUG:[bitfinex] API: 2018/06/21 15:36:20:149 | Info | Socket connection established
15:36:20.21[40]DEBUG:[bitfinex] API: 2018/06/21 15:36:20:150 | Info | Websocket version: 2, platform status: operational
2018/06/21 15:36:20:230 | Info | Authentication successful
15:36:20.23[40]DEBUG:[bitfinex] API: 2018/06/21 15:36:20:230 | Info | Authentication successful
After it no more trades was received.
Bitfinex.NET connects and reconnects to Bitfinex at least once per day, sometime many times a day.
I get it because I log the events BitfinexSocketClient.ConnectionLost and BitfinexSocketClient.ConnectionRestored
.
Sometimes Bitfinex.NET reconnects but the candle subscription (opened at startup with BitfinexSocketClient.SubscribeToCandleUpdates
) is not restored.
I thought about a timer to detect if data is still arriving and, if not, close-reopen connection from scratch.
Is there a better way to deal with the issue ?
P.S.: my machine is in a datacenter with 99.9 connectivity SLA, so connections/reconnections are probably originated from Bitfinex endpoint and inherent to their service.
11:08:43.11[154]DEBUG:[Bitfinex_v7] API: 2018/07/24 11:08:43:118 | Error | Error in processing loop. System.FormatException, Входная строка имела неверный формат., в System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
в System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
в CryptoExchange.Net.Converters.TimestampConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
в Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
в Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
в Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
в Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
в CryptoExchange.Net.Converters.ArrayConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
в Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
в Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
в Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
в Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
в Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
в Bitfinex.Net.Objects.SocketObjects.SubscriptionRegistration.Handle(BitfinexEventType type, JArray obj)
в Bitfinex.Net.BitfinexSocketClient.ProcessData(), message: [2,"te",[272098900,1532419722268,-0.1,7996.2]]
11:08:43.13[154]DEBUG:[Bitfinex_v7] API: 2018/07/24 11:08:43:136 | Error | Error in processing loop. System.FormatException, Входная строка имела неверный формат., в System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
в System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
в CryptoExchange.Net.Converters.TimestampConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
в Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
в Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
в Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
в Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
в CryptoExchange.Net.Converters.ArrayConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
в Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
в Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
в Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
в Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
в Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
в Bitfinex.Net.Objects.SocketObjects.SubscriptionRegistration.Handle(BitfinexEventType type, JArray obj)
в Bitfinex.Net.BitfinexSocketClient.ProcessData(), message: [2,"tu",[272098896,1532419722258,-0.4,7996.3]]
2018/06/28 18:18:12:993 | Debug | Creating request for https://api.bitfinex.com/v1/order/new
18:18:12.99[88]DEBUG:[bitfinex] API: 2018/06/28 18:18:12:993 | Debug | Creating request for https://api.bitfinex.com/v1/order/new
2018/06/28 18:18:13:002 | Debug | Sending signed request to https://api.bitfinex.com/v1/order/new with parameters symbol=btcusd, amount=0.001, price=6113, exchange=bitfinex, side=sell, type=exchange limit,
18:18:13.00[88]DEBUG:[bitfinex] API: 2018/06/28 18:18:13:002 | Debug | Sending signed request to https://api.bitfinex.com/v1/order/new with parameters symbol=btcusd, amount=0.001, price=6113, exchange=bitfinex, side=sell, type=exchange limit,
18:18:13.16[2]FATAL:UnobservedTaskExceptio:
System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Bitfinex.Net.BitfinexSocketClient.d__87.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Bitfinex.Net.BitfinexSocketClient.<SubscribeUnsend>d__92.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Bitfinex.Net.BitfinexSocketClient.<<SocketOpened>b__91_0>d.MoveNext() --- End of inner exception stack trace --- ---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object. at Bitfinex.Net.BitfinexSocketClient.<SubscribeAndWait>d__87.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()
at Bitfinex.Net.BitfinexSocketClient.d__92.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Bitfinex.Net.BitfinexSocketClient.<b__91_0>d.MoveNext()<---
2018/06/28 18:18:13:214 | Warning | Server returned an error: {"message":"Invalid order: minimum size for BTC/USD is 0.002"}
18:18:13.21[43]DEBUG:[bitfinex] API: 2018/06/28 18:18:13:214 | Warning | Server returned an error: {"message":"Invalid order: minimum size for BTC/USD is 0.002"}
Hi @JKorf I cannot install Bitfinex.Net packet in nuget
-I used .Net 4.7
-Window form application
-Visual studio 2015
Hi,
After upgrading CryptoExchange.Net to 0.0.23
WebSocket stopped working, throwing
System.MissingMethodException: 'Method not found: 'CryptoExchange.Net.Interfaces.IWebsocket CryptoExchange.Net.Interfaces.IWebsocketFactory.CreateWebsocket(System.String)'.'
This throws only on .net 4.7, on .net core it's working as usual.
Same on 0.0.22.
0.0.21 is ok.
I traced down the error and it's coming from BaseConverter.ReadJson in CryptoExchange project.
Here's the stack trace:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=CryptoExchange.Net
StackTrace:
at CryptoExchange.Net.Converters.BaseConverter`1.<>c__DisplayClass5_0.<ReadJson>b__0(KeyValuePair`2 v) in \CryptoExchange.Net\Converters\BaseConverter.cs:line 28
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at CryptoExchange.Net.Converters.BaseConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in C:\Users\Ahd-w10\source\repos\CryptoExchange.Net\Converters\BaseConverter.cs:line 32
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
Looking at the code, I see this:
private void ProcessSending()
{
while (running)
{
while (toSendMessages.TryTake(out string data, TimeSpan.FromMilliseconds(100)))
{
log.Write(LogVerbosity.Debug, "Sending " + data);
socket.Send(data);
}
}
}
and
private void ProcessData()
{
while (running)
{
var received = receivedMessages.TryTake(out string dequeued, TimeSpan.FromMilliseconds(100));
if (!received)
...
Will the TryTake(x, 100ms) cause delays to PlacingOrder and receiving market data?
Is it possible to make the TimeFrame not an enum or have an overload where we can specify timeframe ourselves? Interested in e.g four hour but that's not an option through the enum.
Hi JKorf,
I use the trade updates to track which of my orders were executed and at what price and size. (Orders don't seem to be useful for this purpose as they do not have execution details.)
I see that Bitfinex sends "te" followed by "tu". So I receive two TradeUpdatesHandler(BitfinexTradeDetails[] trade) callbacks that are very similar. To differentiate them, right now, I do that by assuming the BitfinexTradeDetails is "te" if it does not have OrderType (based on my observations of the logs). I only care about "te" since it comes first and already have the details I need.
But that is not safe because there is no guarantee in the specs that this would be the case in future. How do most users track the executed fills and differentiate between te and tu?
Hi.
When I manually close positions on margin account (to reset positions opened by Trading system I'm developing/testing) BitFinex.NET states (in immediate window) :
Couldn't deserialize order status: INSUFFICIENT BALANCE (G1) was: ACTIVE (note:POSCLOSE), PARTIALLY FILLED @ 6123.96104092(-0.07139999)
Couldn't deserialize order status: INSUFFICIENT BALANCE (G1) was: ACTIVE (note:POSCLOSE), PARTIALLY FILLED @ 6123.96104092(-0.07139999)
Couldn't deserialize order status: INSUFFICIENT BALANCE (G1) was: ACTIVE (note:POSCLOSE), PARTIALLY FILLED @ 458.76(-0.7182)
Couldn't deserialize order status: INSUFFICIENT BALANCE (G1) was: ACTIVE (note:POSCLOSE), PARTIALLY FILLED @ 458.76(-0.7182)
Take the first: I manually closed a position of 0.0714 tBTCUSD. Bitfinex system raises an error for insufficient balance (a bitfinex bug, in my opinion) and closes 0.07139999 tBTCUSD keeping the rest as trading fee.
But BitFinex.NET OrderUpdate Subscription is not able to deserialize message.
Hi.
VS Immediate windows posts errors in parsing trades:
2018/06/22 23.16.13.308 | Error | Error in processing loop. Newtonsoft.Json.JsonSerializationException, Error converting value "EXCHANGE LIMIT" to type 'System.Nullable`1[Bitfinex.Net.Objects.OrderType]'. Path '[6]', line 1, position 81., at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
at CryptoExchange.Net.Converters.ArrayConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
at Bitfinex.Net.Objects.SocketObjects.SubscriptionRegistration.Handle(JArray obj)
at Bitfinex.Net.BitfinexSocketClient.ProcessData(), message: [0,"te",[260754156,"tBTCUSD",1529702173281,13583268783,-0.5,5968,"EXCHANGE LIMIT",5968,1]]
2018/06/22 23.16.13.332 | Error | Error in processing loop. Newtonsoft.Json.JsonSerializationException, Error converting value "EXCHANGE LIMIT" to type 'System.Nullable`1[Bitfinex.Net.Objects.OrderType]'. Path '[6]', line 1, position 81., at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
at CryptoExchange.Net.Converters.ArrayConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
at Bitfinex.Net.Objects.SocketObjects.SubscriptionRegistration.Handle(JArray obj)
at Bitfinex.Net.BitfinexSocketClient.ProcessData(), message: [0,"tu",[260754156,"tBTCUSD",1529702173281,13583268783,-0.5,5968,"EXCHANGE LIMIT",5968,1,-2.984,"USD"]]
I see there's an ExchangeStopLimit but no StopLimit in OrderType.
Hello.
Thank You have developed this library, Now I want to use to see my wallet information on bitfinex how to do?
I looked in the test folder and did not see an example of that.
Thank you.
Son.
version of library is latest.
18:13:36.60[46]DEBUG:[bitfinex] API: 2018/06/28 18:13:36:579 | Warning | No data received for 15 seconds, restarting connection
18:13:36.63[30]ERROR:AfterConnect:
System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Bitfinex.Net.BitfinexSocketClient.d__87.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Bitfinex.Net.BitfinexSocketClient.d__79.MoveNext()
There is a problem with subscriptions resend after losing a connection.
Lib says there are no subscriptions to resend, while there is one.
| Warning | No data received for 15 seconds, restarting connection
2018-07-19 11:47:10:594 | Info | Socket connection established
2018-07-19 11:47:10:599 | Info | Websocket version: 2, platform status: operational
2018-07-19 11:47:10:606 | Info | 0 subscriptions to resend
But sometimes it does resend subscriptions, throwing InvalidOperationException on linq's method.
Sorry I didn't copy that exception, but it was something with a loop and multiple elements while expecting single element.
Hi @JKorf -- nice libraries :) I'm using your Bittrex lib, but noticed that those guys charge a lot for withdrawals to off-exchange wallets.
Any plans to add withdrawal support to your Bitfinex library? Apologies if I missed it, but can't see any methods to do that.
Hi JKorf,
When I call this function:
var placeResult = client.PlaceOrder(OrderType.ExchangeFillOrKill, "tBTCUSD", amt, clientOrderId:OrderID, price:(decimal)price);
I get success if my price results in a fill. But if I place an off-market price (say sell order at 6650 when the bid is 6600), the function waits ConfirmationTimeout and then returned as failed.
If I look at the logs though, it seems the order was placed and an "oc" was received quickly. Why does PlaceOrder consider it a failure then? Logs below.
2018/07/10 17:07:50:044 | Info | Going to place order
2018/07/10 17:07:50:072 | Debug | Sending [0,"on",null,{"type":"EXCHANGE FOK","symbol":"tBTCUSD","amount":"-0.002","price":"6650","cid":0}]
2018/07/10 17:07:50:398 | Debug | Received message: [0,"n",[1531213671928,"on-req",null,null,[14193804016,null,0,"tBTCUSD",null,null,-0.002,-0.002,"EXCHANGE FOK",null,null,null,null,null,null,null,6650,null,null,null,null,null,null,0,null,null,null,null,null,null,null,null],null,"SUCCESS","Submitting exchange fok sell order for 0.002 BTC."]]
2018/07/10 17:07:50:398 | Debug | Received message: [0,"oc",[14193804016,null,0,"tBTCUSD",1531213671877,1531213671901,-0.002,-0.002,"EXCHANGE FOK",null,null,null,0,"FILLORKILL CANCELED",null,null,6650,0,null,null,null,null,null,0,0,0,null,null,"API>BFX",null,null,null]]
2018/07/10 17:07:50:398 | Debug | Processing [0,"n",[1531213671928,"on-req",null,null,[14193804016,null,0,"tBTCUSD",null,null,-0.002,-0.002,"EXCHANGE FOK",null,null,null,null,null,null,null,6650,null,null,null,null,null,null,0,null,null,null,null,null,null,null,null],null,"SUCCESS","Submitting exchange fok sell order for 0.002 BTC."]]
2018/07/10 17:07:50:399 | Debug | Processing [0,"oc",[14193804016,null,0,"tBTCUSD",1531213671877,1531213671901,-0.002,-0.002,"EXCHANGE FOK",null,null,null,0,"FILLORKILL CANCELED",null,null,6650,0,null,null,null,null,null,0,0,0,null,null,"API>BFX",null,null,null]]
2018/07/10 17:07:59:877 | Debug | Received message: [0,"hb"]
2018/07/10 17:07:59:877 | Debug | Processing [0,"hb"]
2018/07/10 17:08:00:072 | Info | Failed to place order
Randomly i receive the error 'No confirmation received for placed order'. When i go to the exchange, the order is actually placed.
Hi, I think something has changed in the Bitfinex API, I started getting these errors. I tried 1.0.3 and 1.0.5 - same result.
Here's simple example:
var result = await client.GetOrderHistoryAsync("tIOTUSD");
if (!result.Success)
{
Console.WriteLine("Error: " + result.Error.Code + "\n" + result.Error.Message);
}
Error: 4
Error deserializing data: Deserialize Unknown Exception: Sequence contains no matching element. Received data: [[11834800778,null,83768609087,"tIOTUSD",1525734969000,1525734968000,10,10,"LIMIT",null,null,null,null,"POSTONLY CANCELED",null,null,2.4,0,0,0,null,null,null,0,0,null,null,null,null,null,null,null]]
Placing OCO orders on Bitfinex generates two orders, e.g. Limit and Stop, that are grouped (GroupId) but when placing an order I only get the first order returned. Is there a way for the method to return both instead of me having to subscribe to order updates and match up?
2018/07/31 11:25:13:487 | Info | Going to place order
2018/07/31 11:25:13:506 | Debug | Sending [0,"on",null,{"type":"MARKET","symbol":"tEOSUSD","amount":"2.051030","price":"0","cid":3546870459106757}]
2018/07/31 11:25:13:629 | Debug | Received message: [0,"n",[1533029112779,"on-req",null,null,[14915345706,null,3546870459106757,"tEOSUSD",null,null,2.05103,2.05103,"MARKET",null,null,null,null,null,null,null,7.3035,null,null,null,null,null,null,0,null,null,null,null,null,null,null,null],null,"SUCCESS","Submitting market buy order for 2.05103 EOS."]]
2018/07/31 11:25:13:632 | Debug | Processing [0,"n",[1533029112779,"on-req",null,null,[14915345706,null,3546870459106757,"tEOSUSD",null,null,2.05103,2.05103,"MARKET",null,null,null,null,null,null,null,7.3035,null,null,null,null,null,null,0,null,null,null,null,null,null,null,null],null,"SUCCESS","Submitting market buy order for 2.05103 EOS."]]
2018/07/31 11:25:13:635 | Debug | Received message: [0,"oc",[14915345706,null,3546870459106757,"tEOSUSD",1533029112766,1533029112785,0,2.05103,"MARKET",null,null,null,0,"EXECUTED @ 7.3134(2.05103)",null,null,7.3035,7.3134,null,null,null,null,null,0,0,0,null,null,"API>BFX",null,null,null]]
2018/07/31 11:25:13:637 | Debug | Received message: [0,"pu",["tEOSUSD","ACTIVE",2.05103,7.3134,0,null,null,null,null,null]]
2018/07/31 11:25:13:637 | Debug | Processing [0,"oc",[14915345706,null,3546870459106757,"tEOSUSD",1533029112766,1533029112785,0,2.05103,"MARKET",null,null,null,0,"EXECUTED @ 7.3134(2.05103)",null,null,7.3035,7.3134,null,null,null,null,null,0,0,0,null,null,"API>BFX",null,null,null]]
2018/07/31 11:25:13:688 | Debug | Processing [0,"pu",["tEOSUSD","ACTIVE",2.05103,7.3134,0,null,null,null,null,null]]
2018/07/31 11:25:13:693 | Info | Order placed
2018/07/31 11:25:13:762 | Info | Going to place order
2018/07/31 11:25:13:808 | Debug | Sending [0,"on",null,{"type":"LIMIT","symbol":"tEOSUSD","amount":"-2.051030","price":"7.386534","price_oco_stop":"7.26586290","flags":16384,"cid":6397157565268897}]
2018/07/31 11:25:13:813 | Info | Subscribing to trade updates for tEOSUSD
2018/07/31 11:25:13:815 | Debug | Sending {"symbol":"tEOSUSD","event":"subscribe","channel":"trades"}
2018/07/31 11:25:13:851 | Debug | Received message: [0,"pu",["tEOSUSD","ACTIVE",2.05103,7.3134,0,0,null,null,null,null]]
2018/07/31 11:25:13:896 | Debug | Processing [0,"pu",["tEOSUSD","ACTIVE",2.05103,7.3134,0,0,null,null,null,null]]
2018/07/31 11:25:13:962 | Debug | Received message: {"channel":"trades","symbol":"tEOSUSD","event":"error","msg":"subscribe: dup","code":10301,"pair":"EOSUSD"}
2018/07/31 11:25:13:985 | Debug | Received message: [0,"n",[1533029113135,"on-req",null,null,[14915345868,null,6397157565268897,"tEOSUSD",null,null,-2.05103,-2.05103,"LIMIT",null,null,null,null,null,null,null,7.3865,null,null,null,null,null,null,0,null,null,null,null,null,null,null,null],null,"SUCCESS","Submitting limit sell order for 2.05103 EOS."]]
2018/07/31 11:25:14:007 | Debug | Processing {"channel":"trades","symbol":"tEOSUSD","event":"error","msg":"subscribe: dup","code":10301,"pair":"EOSUSD"}
2018/07/31 11:25:14:028 | Debug | Received message: [0,"on",[14915345869,null,33913107787,"tEOSUSD",1533029113109,1533029113130,-2.05103,-2.05103,"STOP",null,null,null,16384,"ACTIVE",null,null,7.2658,0,null,null,null,null,null,0,0,14915345868,null,null,"",null,null,null]]
2018/07/31 11:25:14:050 | Debug | Processing [0,"n",[1533029113135,"on-req",null,null,[14915345868,null,6397157565268897,"tEOSUSD",null,null,-2.05103,-2.05103,"LIMIT",null,null,null,null,null,null,null,7.3865,null,null,null,null,null,null,0,null,null,null,null,null,null,null,null],null,"SUCCESS","Submitting limit sell order for 2.05103 EOS."]]
2018/07/31 11:25:14:073 | Debug | Received message: [0,"on",[14915345868,null,6397157565268897,"tEOSUSD",1533029113104,1533029113130,-2.05103,-2.05103,"LIMIT",null,null,null,16384,"ACTIVE",null,null,7.3865,0,null,null,null,null,null,0,0,14915345869,null,null,"API>BFX",null,null,null]]
2018/07/31 11:25:14:096 | Debug | Processing [0,"on",[14915345869,null,33913107787,"tEOSUSD",1533029113109,1533029113130,-2.05103,-2.05103,"STOP",null,null,null,16384,"ACTIVE",null,null,7.2658,0,null,null,null,null,null,0,0,14915345868,null,null,"",null,null,null]]
2018/07/31 11:25:14:121 | Debug | Processing [0,"on",[14915345868,null,6397157565268897,"tEOSUSD",1533029113104,1533029113130,-2.05103,-2.05103,"LIMIT",null,null,null,16384,"ACTIVE",null,null,7.3865,0,null,null,null,null,null,0,0,14915345869,null,null,"API>BFX",null,null,null]]
2018/07/31 11:25:14:123 | Info | Order placed
How to add a trailing stop order via Bitfinex.NET API? The current version of the PlaceOrder method allows to pass only one price:
PlaceOrder(string symbol, OrderSide side, type, decimal amount, decimal price)
Hi there,
I've been trying your library to see if I could retrieve orders history etc because I've been struggling to do so myself but I get APIKey Invalid error.
static async Task Main(string[] args)
{
var options = new BitfinexClientOptions()
{
ApiCredentials = new ApiCredentials("something", "something")
};
using (var client = new BitfinexClient(options))
{
var result = await client.GetOrderHistoryAsync("tBTCUSD");
}
}
Do you know why this occurs? Tried generating new api keys and testing them as well to no luck.
Hi again,
I get a lot of these nonce: small
errors on startup. I'm thinking it's due to me issuing subscriptions at the same time due to multi-threading (I load up my trading pairs asynchronously which in turn issues subscriptions).
Can we add a lock or something to prevent this if I'm not being weird in the way I want to utilize the client 😅
2018/07/03 09:47:40:458 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:459 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:537 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:538 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:602 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:604 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:635 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:644 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:656 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:662 | Warning | Server returned an error: ["error",10114,"nonce: small"]
2018/07/03 09:47:40:685 | Warning | Server returned an error: ["error",10114,"nonce: small"]
... GetUrl(FillPathParameter(OrderBookEndpoint, symbol, precision.ToString()) ... <<< makes endpoint 'book/tETHUSD/PrecisionLevel0' instead of the correct value 'book/tETHUSD/P0'
Hello,
I dont understand correctly how to use the SubscribeToBookUpdates Websocket... and i dont find any example how to use correctly the websockets..
var options = new BitfinexSocketClientOptions()
{
ApiCredentials = new ApiCredentials(KEY, SECRET)
};
var client = new BitfinexSocketClient(options);
var tickerSub = await client.SubscribeToBookUpdates("tBTCUSD", 0, 0, 10, data =>
{
AppendTextBox("Ticker update");
});
How i can use now the Orderbook with "Updates" (Price, Amount, Total) in a listbox in a neverending while with resub/reconnecting?
The other Question, is it better to use multiple Tasks for each Pair or can handle a Task 10 Pairs?
and the last Question, the frequency 0 = realtime updates? (i hope yes)
thank you
i'm doing some tests with my application,
when i set the api credentials, and call, for istance, GetWalletsAsync()
the entire application hangs and get stuck,
i noticed it worked fine just the first time.
apparently it get stucks on this line :
using (var stream = request.GetRequestStream().Result)
on BitfinexClient.cs , line 852
i checked my api key on the website and it seems to be working fine.
the code is the same you provided:
BitfinexClient.SetDefaultOptions(new BitfinexClientOptions(){
ApiCredentials = new ApiCredentials("APIKEY", "APISECRET")
});
using(var client = new BitfinexClient())
{
var walletResult = client.GetWallets();
if(!walletResult.Success)
Console.WriteLine("Error: " + walletResult.Error);
else
{
foreach(var wallet in walletResult.Data)
Console.WriteLine(wallet.Currency + ": " + wallet.Balance);
}
}
please help me, what i have to check?
var result = await client.GetOrderHistoryAsync("tBTCUSD");
foreach (var order in result.Data)
{
Console.WriteLine(order.Status.ToString()); // all orders are active
}
I fond several methods in code where limit parameter was typed as "len": GetOrderBookAsync, GetOrderHistoryAsync, GetTradeHistoryAsync, GetFundingOfferHistoryAsync, GetFundingLoansHistoryAsync, GetFundingCreditsHistoryAsyncTask and GetFundingTradesHistoryAsync.
Because of that every call returns default number of records.
parameters.AddOptionalParameter("len", limit?.ToString());
Should be "limit".
Hi, I tried installing with Nuget and got the following error:
Could not install package 'Bitfinex.Net 1.0.19'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework
Which framework does this package target?
2018/06/21 13:58:18:286 | Error | Error in processing loop. System.InvalidOperationException, Sequence contains more than one matching element, at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func
2 predicate)
at Bitfinex.Net.BitfinexSocketClient.ProcessData(), message: {"event":"subscribed","channel":"book","chanId":2246,"symbol":"tBCHBTC","prec":"P0","freq":"F0","len":"25","pair":"BCHBTC"}
13:58:18.28[32]DEBUG:[bitfinex] API: 2018/06/21 13:58:18:286 | Error | Error in processing loop. System.InvalidOperationException, Sequence contains more than one matching element, at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func
2 predicate)
at Bitfinex.Net.BitfinexSocketClient.ProcessData(), message: {"event":"subscribed","channel":"book","chanId":2246,"symbol":"tBCHBTC","prec":"P0","freq":"F0","len":"25","pair":"BCHBTC"}
If you place an OCO order then you get two orders in a group. In their web interface you can't cancel just one of them because they're a part of an OCO order so you have to cancel both at the same time and with the group id.
Is it possible for you to add an overload to cancel order that correlates to https://bitfinex.readme.io/v2/reference#ws-input-order-cancel-multi ?
03:46:18.78[596]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:18:786 | Warning | Received unknown event type: [
8238.8,
9.99188904,
8240.9,
27.31380111,
-201.1,
-0.0238,
8236.8,
34477.45553309,
8469.2,
8073
]
03:46:18.78[86]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:18:789 | Warning | Received unknown event type: [
8238.8,
9.99188904,
8240.9,
27.31380111,
-201.1,
-0.0238,
8236.8,
34477.45553309,
8469.2,
8073
]
03:46:18.79[336]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:18:790 | Warning | Received unknown event type: [
8238.8,
9.99188904,
8240.9,
27.31380111,
-201.1,
-0.0238,
8236.8,
34477.45553309,
8469.2,
8073
]
03:46:18.83[269]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:18:833 | Warning | Received unknown event type: [
8238.8,
9.99188904,
8240.9,
27.31380111,
-201.1,
-0.0238,
8236.8,
34477.45553309,
8469.2,
8073
]
03:46:27.47[304]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:27:473 | Info | Received status code 20051, going to reconnect the websocket
03:46:27.47[491]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:27:474 | Info | Received status code 20051, going to reconnect the websocket
03:46:33.74[269]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:33:742 | Warning | Received unknown event type: [
8242.2,
430.05947569,
8242.3,
11.74478501,
-195.6,
-0.0232,
8242.3,
34477.47787126,
8469.2,
8073
]
03:46:33.75[86]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:33:757 | Warning | Received unknown event type: [
8242.2,
430.05947569,
8242.3,
11.74478501,
-195.6,
-0.0232,
8242.3,
34477.47787126,
8469.2,
8073
]
03:46:33.76[336]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:33:760 | Warning | Received unknown event type: [
8242.2,
430.05947569,
8242.3,
11.74478501,
-195.6,
-0.0232,
8242.3,
34477.47787126,
8469.2,
8073
]
03:46:33.76[596]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:33:762 | Warning | Received unknown event type: [
8242.2,
430.05947569,
8242.3,
11.74478501,
-195.6,
-0.0232,
8242.3,
34477.47787126,
8469.2,
8073
]
03:46:42.47[304]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:474 | Warning | No data received for 15 seconds, restarting connection
03:46:42.52[491]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:529 | Warning | No data received for 15 seconds, restarting connection
03:46:42.86[257]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:868 | Info | Socket connection established
03:46:42.87[180]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:870 | Info | Socket connection established
03:46:42.87[75]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:870 | Info | 0 subscriptions to resend
03:46:42.87[186]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:870 | Info | 0 subscriptions to resend
03:46:42.87[186]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:872 | Info | Websocket version: 2, platform status: operational
03:46:42.87[75]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:875 | Info | Websocket version: 2, platform status: operational
03:46:42.96[75]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:960 | Info | Authentication successful
03:46:42.96[186]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:42:969 | Info | Authentication successful
03:46:43.18[304]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:43:188 | Info | Socket connection established
03:46:43.18[81]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:43:188 | Info | 0 subscriptions to resend
03:46:43.19[81]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:43:190 | Info | Websocket version: 2, platform status: operational
03:46:43.26[81]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:43:261 | Info | Authentication successful
03:46:43.27[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:43:272 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:46:48.75[336]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:48:752 | Warning | Received unknown event type: [
8243.4,
458.48980304,
8243.5,
9.62246263,
-194.5,
-0.0231,
8243.4,
34477.65954299,
8469.2,
8073
]
03:46:48.75[596]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:48:754 | Warning | Received unknown event type: [
8243.4,
458.48980304,
8243.5,
9.62246263,
-194.5,
-0.0231,
8243.4,
34477.65954299,
8469.2,
8073
]
03:46:48.78[269]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:48:783 | Warning | Received unknown event type: [
8243.4,
458.48980304,
8243.5,
9.62246263,
-194.5,
-0.0231,
8243.4,
34477.65954299,
8469.2,
8073
]
03:46:49.15[86]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:46:49:159 | Warning | Received unknown event type: [
8243.4,
458.48980304,
8243.5,
9.62246263,
-194.5,
-0.0231,
8243.4,
34477.65954299,
8469.2,
8073
]
03:47:04.05[336]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:04:058 | Warning | Received unknown event type: [
8243.5,
19.76097226,
8246.1,
14.78054756,
-191.1,
-0.0226,
8246.8,
34478.91350044,
8469.2,
8073
]
03:47:04.06[86]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:04:060 | Warning | Received unknown event type: [
8243.5,
19.76097226,
8246.1,
14.78054756,
-191.1,
-0.0226,
8246.8,
34478.91350044,
8469.2,
8073
]
03:47:04.07[596]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:04:079 | Warning | Received unknown event type: [
8243.5,
19.76097226,
8246.1,
14.78054756,
-191.1,
-0.0226,
8246.8,
34478.91350044,
8469.2,
8073
]
03:47:04.43[269]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:04:438 | Warning | Received unknown event type: [
8243.5,
19.76097226,
8246.1,
14.78054756,
-191.1,
-0.0226,
8246.8,
34478.91350044,
8469.2,
8073
]
03:47:19.62[269]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:19:624 | Warning | Received unknown event type: [
8240.1,
10.20073784,
8241,
15.66815979,
-197.8,
-0.0234,
8240.1,
34479.68118951,
8469.2,
8073
]
03:47:19.62[336]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:19:626 | Warning | Received unknown event type: [
8240.1,
10.20073784,
8241,
15.66815979,
-197.8,
-0.0234,
8240.1,
34479.68118951,
8469.2,
8073
]
03:47:19.62[596]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:19:628 | Warning | Received unknown event type: [
8240.1,
10.20073784,
8241,
15.66815979,
-197.8,
-0.0234,
8240.1,
34479.68118951,
8469.2,
8073
]
03:47:19.65[86]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:19:653 | Warning | Received unknown event type: [
8240.1,
10.20073784,
8241,
15.66815979,
-197.8,
-0.0234,
8240.1,
34479.68118951,
8469.2,
8073
]
03:47:34.70[86]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:34:708 | Warning | Received unknown event type: [
8240.1,
11.26025517,
8240.2,
10.09732421,
-197.8,
-0.0234,
8240.1,
34479.68118951,
8469.2,
8073
]
03:47:34.71[336]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:34:712 | Warning | Received unknown event type: [
8240.1,
11.26025517,
8240.2,
10.09732421,
-197.8,
-0.0234,
8240.1,
34479.68118951,
8469.2,
8073
]
03:47:34.71[269]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:34:716 | Warning | Received unknown event type: [
8240.1,
11.26025517,
8240.2,
10.09732421,
-197.8,
-0.0234,
8240.1,
34479.68118951,
8469.2,
8073
]
03:47:34.71[596]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:47:34:718 | Warning | Received unknown event type: [
8240.1,
11.26025517,
8240.2,
10.09732421,
-197.8,
-0.0234,
8240.1,
34479.68118951,
8469.2,
8073
]
03:48:03.88[596]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:03:887 | Warning | Received unknown event type: [
8240.1,
16.91216406,
8240.2,
35.62725533,
-197.7,
-0.0234,
8240.2,
34480.34364177,
8469.2,
8073
]
03:48:03.88[269]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:03:887 | Warning | Received unknown event type: [
8240.1,
16.91216406,
8240.2,
35.62725533,
-197.7,
-0.0234,
8240.2,
34480.34364177,
8469.2,
8073
]
03:48:03.88[86]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:03:888 | Warning | Received unknown event type: [
8240.1,
16.91216406,
8240.2,
35.62725533,
-197.7,
-0.0234,
8240.2,
34480.34364177,
8469.2,
8073
]
03:48:03.90[336]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:03:909 | Warning | Received unknown event type: [
8240.1,
16.91216406,
8240.2,
35.62725533,
-197.7,
-0.0234,
8240.2,
34480.34364177,
8469.2,
8073
]
03:48:09.74[280]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:09:741 | Warning | No data received for 15 seconds, restarting connection
03:48:09.81[280]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:09:815 | Info | Resetting subscription requests
03:48:14.13[487]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:14:136 | Warning | No data received for 15 seconds, restarting connection
03:48:16.64[113]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:16:640 | Warning | No data received for 15 seconds, restarting connection
03:48:17.06[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:17:064 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:17.78[57]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:17:786 | Info | Socket connection established
03:48:17.78[23]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:17:788 | Info | 0 subscriptions to resend
03:48:17.78[23]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:17:788 | Info | Websocket version: 2, platform status: operational
03:48:17.87[23]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:17:878 | Info | Authentication successful
03:48:17.99[470]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:17:992 | Warning | No data received for 15 seconds, restarting connection
03:48:18.06[470]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:064 | Info | Resetting subscription requests
03:48:18.08[113]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:086 | Info | Socket connection established
03:48:18.09[470]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:091 | Info | 0 subscriptions to resend
03:48:18.09[470]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:091 | Info | Websocket version: 2, platform status: operational
03:48:18.18[470]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:183 | Info | Authentication successful
03:48:18.18[555]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:186 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:18.34[553]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:345 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:18.42[280]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:424 | Info | Socket connection established
03:48:18.42[252]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:424 | Info | 2 subscriptions to resend
03:48:18.43[487]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:433 | Info | Websocket version: 2, platform status: operational
03:48:18.49[252]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:497 | Info | Successfuly (re)subscribed Bitfinex.Net.Objects.SocketObjects.TickerSubscriptionRequest
03:48:18.50[487]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:508 | Info | Authentication successful
03:48:18.57[252]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:571 | Info | Successfuly (re)subscribed Bitfinex.Net.Objects.SocketObjects.TradesSubscriptionRequest
03:48:18.92[555]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:922 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:18.93[310]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:932 | Warning | No data received for 15 seconds, restarting connection
03:48:18.94[310]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:948 | Info | Resetting subscription requests
03:48:18.97[461]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:18:974 | Warning | No data received for 15 seconds, restarting connection
03:48:19.01[553]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:015 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:19.06[461]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:066 | Info | Resetting subscription requests
03:48:19.16[348]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:169 | Warning | No data received for 15 seconds, restarting connection
03:48:19.17[60]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:174 | Warning | No data received for 15 seconds, restarting connection
03:48:19.22[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:227 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:19.25[348]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:254 | Info | Resetting subscription requests
03:48:19.47[269]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:473 | Warning | Received unknown event type: [
8237.7,
15.75575569,
8237.8,
12.62684243,
-200.1,
-0.0237,
8237.8,
34494.17600044,
8469.2,
8073
]
03:48:19.49[86]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:498 | Warning | Received unknown event type: [
8237.7,
15.75575569,
8237.8,
12.62684243,
-200.1,
-0.0237,
8237.8,
34494.17600044,
8469.2,
8073
]
03:48:19.50[336]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:500 | Warning | Received unknown event type: [
8237.7,
15.75575569,
8237.8,
12.62684243,
-200.1,
-0.0237,
8237.8,
34494.17600044,
8469.2,
8073
]
03:48:19.68[596]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:682 | Warning | Received unknown event type: [
8237.7,
15.75575569,
8237.8,
12.62684243,
-200.1,
-0.0237,
8237.8,
34494.17600044,
8469.2,
8073
]
03:48:19.68[555]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:19:684 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:20.70[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:20:703 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:20.78[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:20:784 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:20.88[416]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:20:882 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:21.15[555]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:21:155 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:21.97[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:21:971 | Warning | Server returned an error: ["error",10114,"nonce: small"]
03:48:22.27[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:272 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.28[553]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:287 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.30[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:304 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.32[553]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:322 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.34[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:340 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.35[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:357 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.37[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:377 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.39[553]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:395 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.41[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:414 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.44[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:440 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.56[555]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:564 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.56[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:567 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.62[555]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:625 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.64[553]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:644 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.69[553]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:697 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.69[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:699 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.74[553]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:744 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
03:48:22.84[2]FATAL:UnobservedTaskExceptio:
System.AggregateException: При ожидании задачи или доступе к ее свойству исключения не были замечены исключения задачи. В результате незамеченные исключения были созданы повторно потоком завершения. ---> System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта.
в Bitfinex.Net.BitfinexSocketClient.b__91_0()
в System.Threading.Tasks.Task.Execute()
--- Конец трассировки внутреннего стека исключений ---
---> (Внутреннее исключение #0) System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта.
в Bitfinex.Net.BitfinexSocketClient.b__91_0()
в System.Threading.Tasks.Task.Execute()<---
03:48:22.84[554]DEBUG:[Bitfinex_v7] API: 2018/07/26 03:48:22:840 | Warning | Server returned an error: ["error", 11010, "ratelimit: error"]
var tempHistory =
client.GetTradeHistory("tBTCUSD", DateTime.Now.ToUniversalTime().AddDays(-5), DateTime.Now.ToUniversalTime(), 100); or any variation of this I get this in the error object of the result
{4: Error deserializing data: Deserialize Unknown Exception: Object reference not set to an instance of an object.. Received data: [[252952940,"tBTCUSD",1527924973000,12901084933,0.03156876,7666.9,null,null,null,-0.00006314,"BTC"],[252951652,"tBTCUSD",1527924776000,12900995488,0.00477249,7670.1,null,null,null,-0.00000954,"BTC"],[252934984,"tBTCUSD",1527922910000,12900002077,-0.0003054,7658,null,null,null,-0.00467751,"USD"],[252934758,"tBTCUSD",1527922893000,12899973746,0.3869,7658.7,null,null,null,-5.92630206,"USD"],[252927963,"tBTCUSD",1527922562000,12899759854,-0.3865946,7651.3,null,null,null,-5.91590253,"USD"],[252926862,"tBTCUSD",1527922546000,12899737779,0.0000571,7630.5,null,null,null,-0.0008714,"USD"],[252923315,"tBTCUSD",1527922518000,12898670820,-0.3743,7595.5,null,null,null,-2.84299565,"USD"],[252911319,"tBTCUSD",1527919925000,12898597891,0.3742429,7491.5,null,null,null,-5.60728137,"USD"],[252909305,"tBTCUSD",1527919836000,12891715880,-0.3748,7476.05004176,null,null,null,-5.60404711,"USD"],[252863064,"tBTCUSD",1527901152000,12891499578,0.3748,7456.4,null,null,null,-5.58931744,"USD"],[252861654,"tBTCUSD",1527901094000,12890631716,-0.3871,7470.7,null,null,null,-5.78381594,"USD"],[252857537,"tBTCUSD",1527899271000,12890599468,0.3871,7513.6,null,null,null,-5.81702912,"USD"],[252857518,"tBTCUSD",1527899263000,12890595080,0.1818,7513.54525316,null,null,null,-2.73192505,"USD"],[252857024,"tBTCUSD",1527899192000,12890550352,-0.1818,7500.7,null,null,null,-2.72725452,"USD"]]}
Unable to resolve dependencies. 'CryptoExchange.Net 0.0.27' is not compatible with 'Bitfinex.Net 1.0.11 constraint: CryptoExchange.Net (= 0.0.25)'.
Hi there.
Two questions:
Thank you
BTW : You did really a great job with the library.
Hi,
Using your great lib I can get only 120 results of historical candles, no matter what I put into
GetCandlesAsync params.
But using a direct link Bitfinex is responding with up to 1000 results.
https://api.bitfinex.com/v2/candles/trade:1m:tBTCUSD/hist?start=1514764800000&limit=1000&sort=1
I was trying to put:
-startTime=correct date, endTime=correct date 1000 minutes later, limit=null
-startTime=correct date, endTime=correct date 1000 minutes later, limit=1000
-startTime=correct date, endTime=null, limit=1000
-startTime=correct date, endTime=null, limit=null
Always GetCandlesAsync returns 120 candles at max.
I'm writing charting app, and trying to download some historical candles, back from 2017.01.01.
While Bitfinex is rate-limitting candles about 20 req/minute + 1 minute pause, it's a real pain to wait for more than 650k candles to download :)
Is it possible to get more then 120 results with your lib ?
Thank you !
Hi,
Could you add Calc Available Balance from the v2 rest api? The available balance is always null in the v2 wallet updates (see issue bitfinexcom/bitfinex-api-node#321 from bitfinex).
At the moment I think it is not possible to get the available balance any other way.
If I start the SocketClient and then try to subscribe to trades I get an exception:
Error in processing loop. System.InvalidOperationException, Sequence contains more than one matching element, at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) at Bitfinex.Net.BitfinexSocketClient.ProcessData(), message: {"event":"subscribed","channel":"trades","chanId":30,"symbol":"tBCHUSD","pair":"BCHUSD"}
The client expects there to only be one subscription result which would be correct. I will investigate myself and see if I can open a PR.
Will be using this library extensively in all our G&H apps moving forward, so would be nice if we could start a Discord or something where we could discuss more frequently instead of opening issues everytime? (Just a suggestion)
Hi there.
the BitFinex websocket client PlaceOrder method accepts the parameter string clientOrderId
.
The BItfinexOrder
class defines the same parameter as int64/long
.
The V2 websock BitFinex API New Order wants int45
in the parameter cid (unique in the day).
Rest API wants a int.
If in this method :
var placeResult = Bcl.PlaceOrder(OrderType.ExchangeStop, symbol: Ord.Symbol, amount: Ord.Amount, clientOrderId: Ord.ClientOrderId.ToString(), price: Ord.Price);
where: Bcl is a BitfinexSocketClient
and Ord is a BItfinexOrder
class.
I pass long.ToString
(value "67358875" got from debug), I receive Server error: cid: invalid.
What's the correct format to pass ?
Is it a Bug ?
Thanks a lot.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.