jandrews377 / bitfinex-rest Goto Github PK
View Code? Open in Web Editor NEWA c# implementation of the Bitfinex REST API Version 2.0
License: Apache License 2.0
A c# implementation of the Bitfinex REST API Version 2.0
License: Apache License 2.0
Confirm that the value for 'Period' that is returned is actually milliseconds.
The code below results in an empty list, history.count = 0. I'm trying to retrieve the trade history between the start and end. Here I have limited the number of records to 120. I think the problem is the override specifies start and end as type int. In C# this defaults to int32. The number to be passed is actually int64 and is not specified correctly in the Bitfinex API documentation. UTC time codes are usually 1s resolution which would fit into an int32. The Trades command in the API specifies 1mS resolution which only fits into an int64. I have a working model of this command in C++ and have verified the documented 1mS resolution.
Your test suite does not test this method override. In general the test suite does not test all method overrides and therefore the testing is not thorough. I suggest a thorough test would have caught this problem. A secondary issue is whether the list is empty as a result of an exchange error. How do I catch the exchange error if an error is returned by the exchange?
These questions will become critical as you add authenticated commands to the package. Errors like "not enough funds in the account" are critical to catch when making trades.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Bitfinex;
using Bitfinex.Models;
namespace BitfinexV2RESTAPITest
{
class Program
{
static void Main(string[] args)
{
List<ITrade> history = new List<ITrade>();
var client = new BitfinexRestClient();
history = client.GetTrades("tBTCUSD", 120, 1501105149000, 1501115149000);
foreach (Bitfinex.Models.ITrade x1 in history.OrderBy(x1 => x1.MTS))
{
Console.WriteLine((x1.MTS).ToString() + " " + (x1.Price).ToString());
}
}
}
}
This url doesnt work:
https://api.bitfinex.com/v2/book/fUSD/P0?len=5
System.AggregateException : System.Exception: (10020) symbol: invalid
Sometimes there is an System.AggregateException
code:
Bitfinex.BitfinexRestClient finex = new Bitfinex.BitfinexRestClient();
Bitfinex.IBitfinexRestClient finex2 = new Bitfinex.BitfinexRestClient();
string currency = "tETCBTC";
List<Bitfinex.Models.IBook> abc = null;
bool orderb = true;
while (orderb)
{
orderb = false;
try
{
abc = finex.GetBooks(currency, Bitfinex.Models.Precision.P0);
}
catch (AggregateException e)
{
Console.WriteLine(e.ToString());
orderb = true;
}
}
Hi there, (not a real issue) did you already manage to get some basic code in C# working for the authenticated endpoints? I'm trying to get it working, but the response keeps saying "invalid api key".
Thanks for your help!
J
The spec says that the start and end are string. We are handling as ints. Need to check with Bitfinex.
is it possible to support .net core?
I compiled this project myself and did same tests in Windows 7, but get this error message:
System.AggregateException
HResult=0x80131500
Message=One or more errors occurred. (Operation is not supported on this platform.)
Source=System.Private.CoreLib
StackTrace:
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Bitfinex.BitfinexRestClient.GetTickers(String[] symbols) in XXXX\bitfinex-rest-master\Bitfinex\TickersClient.cs:line 31
at ConsoleApp1.Program.Main(String[] args) in XXXXX\bitfinex-rest-master\ConsoleApp1\Program.cs:line 12
Exception: Operation is not supported on this platform.
any advice?
Hi, Just a little one.. The new pairs are not available in you Symbol enum.
Happy new year
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.