Giter Site home page Giter Site logo

coinapi / coinapi-sdk Goto Github PK

View Code? Open in Web Editor NEW
457.0 35.0 181.0 84.67 MB

SDKs for CoinAPI

Home Page: https://docs.coinapi.io/

License: MIT License

PHP 9.87% C# 18.04% Python 15.01% Objective-C 0.03% Go 0.09% JavaScript 5.99% TypeScript 6.50% HTML 0.01% Ruby 4.44% Haskell 2.64% C++ 12.98% Makefile 0.01% Batchfile 0.01% Java 11.54% Swift 0.03% R 5.67% Shell 1.76% Ada 1.34% Apex 4.06% Dockerfile 0.01%
bitcoin api api-client api-rest apis cryptocurrencies market-data trading-api ripple ethereum

coinapi-sdk's Introduction

CoinAPI-SDK

GitHub language count

Welcome to the CoinAPI SDK. This repository contain SDK for our API documented at https://docs.coinapi.io/

Repository organization

Directory Description
data-api SDK for CoinAPI Market Data API
ems-cloud-mgmt-sdk SDK for CoinAPI Execution Management System Managed Cloud REST API
ems-gateway-rest-sdk SDK for CoinAPI Execution Management System REST API
ems-gateway-fix SDK for CoinAPI Execution Management System FIX API
cryptotick-samples Examples related to processing CryptoTick GZIP+CSV flat files

Package managers coverage

Language Package manager Protocol Package name Version/Link
C# NuGet REST CoinAPI.REST.V1 Nuget
C# NuGet WebSocket CoinAPI.WebSocket.V1 Nuget
Java Maven
(GitHub Packages)
REST io.coinapi.rest.v1 https://github.com/coinapi/coinapi-sdk/packages/397337
Java Maven
(GitHub Packages)
WebSocket io.coinapi.websocket.v1 https://github.com/coinapi/coinapi-sdk/packages/397352
Python3 PyPI REST coinapi.rest.v1 PyPI

Language coverage

In this repository you can find libraries that will help you use our API with minimal development effort from languages like:

  • Python
  • R
  • Matlab
  • C#
  • C++
  • .NET
  • Java
  • Ruby
  • Go
  • JavaScript
  • TypeScript
  • Node.js
  • PHP
  • Haskell
  • Objective-C
  • Swift

Feel free to make Pull Request with proposed changes or create an Issue on which we respond as soon as possible.

coinapi-sdk's People

Contributors

199sm avatar 4562448 avatar anback avatar andrewmanhaychiu avatar byblakeorriver avatar charvi5 avatar coinapisupport avatar dahifi avatar dependabot[bot] avatar iajrz avatar jsdelivrbot avatar kgrudzien avatar martin-molinero avatar marvin-hansen avatar mateusz-osojca avatar mayoralito avatar nighteule5 avatar penguinawesome avatar ramshreyas avatar redklouds avatar stalin-777 avatar svisstack avatar szalanski avatar tprzybysz avatar tschm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coinapi-sdk's Issues

type_is_crypto is int instead of bool

curl https://rest.coinapi.io/v1/assets   --request GET --header "X-CoinAPI-Key: key"
[
  {
    "asset_id": "BTC",
    "name": "Bitcoin",
    "type_is_crypto": 1,
    "data_start": "2010-07-17",
    "data_end": "2018-05-01",
    "data_quote_start": "2014-02-24T17:43:05.0000000Z",
    "data_quote_end": "2018-04-30T23:06:35.4455119Z",
    "data_orderbook_start": "2014-02-24T17:43:05.0000000Z",
    "data_orderbook_end": "2018-04-30T23:06:35.4455119Z",
    "data_trade_start": "2010-07-17T23:09:17.0000000Z",
    "data_trade_end": "2018-05-01T05:00:40.0000000Z",
    "data_trade_count": 4083899375,
    "data_symbols_count": 6235
  },

This makes go-rest Asset error:

type Asset struct {
	Asset_id       string `json:"asset_id"`
	Name           string `json:"name"`
	Type_is_crypto bool   `json:"type_is_crypto"`
}

API returns empty list for HUOBI_SPOT_ETH_USDT

I am not able to pull any result using the symbol 'HUOBI_SPOT_ETH_USDT'. However, 'HUOBIPRO_SPOT_ETH_USDT' works fine. I'm wondering why is that. Could anyone look into this? Many thanks!

C# Library

Is there a reason that the c# version is released as a console application instead of a class library? Presumably anyone who wants to use it is going to have to customize it into a class library and make the class "CoinApi" public if that actually want to use it.

Java api code BUG: java_rest_coin_api.get_json fails to release resources

The sole Java API class java_rest_coin_api has a method named get_json that has 2 local variables, client and response, that are resources that should always be immediately closed.

Failure to close these resources in the current official version of get_json initially caused my Java programs to hang (never end naturally) until I fixed these bugs.

The hack rewrite of get_json that I came up with is:

	private String get_json(String url) throws IOException, exception {
		OkHttpClient client = new OkHttpClient();
		
		//RequestBody body = RequestBody.create(null, new byte[0]);    // no need to create, since it is only used in a commented out .post line below
		
		Request request = new Request.Builder()
			.url("https://rest.coinapi.io" + url)
			//.post(body)
			.addHeader("X-CoinAPI-Key", key)
			.build();
		//System.out.println(request.url().toString());
		
		try ( Response response = client.newCall(request).execute() ) {    // you MUST always immediately close response, easiest way is like this; see https://square.github.io/okhttp/3.x/okhttp/okhttp3/ResponseBody.html 
			if (response.code() >= 400) {
				String error = "Error code " + response.code();
				try {
					JSONObject object = new JSONObject(response.body().string());
					error = object.getString("error");
				} catch (Exception ex) {
				}
				throw new exception(response.code(), error);
			}
			return response.body().string();
		}
		finally {
			client.dispatcher().executorService().shutdown();
			client.connectionPool().evictAll();
			//client.cache().close();    // only call this if client was created with a cache; the one above was NOT
		}
	}

I am almost totally unfamiliar with the OkHttp library being used inside this method, so this code should be scrutinized by someone who does know that library.

The way that I close client above is discussed in this link.

An alternative approach is that when request is created, you could add .header("Connection", "close").

That link also mentions that client is meant to be shared--each instance has its own connection and thread pools--so having it be a local variable is a performance mistake. It should be a field of some top level class. If you do this, you may need to add a shutdown hook that calls those methods above to close client at that point.

Do you have a basic example for Elixir or Erlang? REST would be fine but Websockets better

I have tried using HTTPoison, for example:

iex(10)> HTTPoison.get "http://www.ibm.com"                                                    
{:ok,
 %HTTPoison.Response{
   body: "",
   headers: [
     {"Server", "AkamaiGHost"},
     {"Content-Length", "0"},
     {"Location", "https://www.ibm.com/"},
     {"Date", "Fri, 16 Mar 2018 23:15:37 GMT"},
     {"Connection", "keep-alive"},
     {"X-Content-Type-Options", "nosniff"},
     {"X-XSS-Protection", "1; mode=block"},
     {"Content-Security-Policy", "upgrade-insecure-requests"}
   ],
   request_url: "http://www.ibm.com",
   status_code: 301
 }}

No problemo. But:

iex(10)> HTTPoison.get "http://v1/exchangerate/BTC?apikey=MYAPIKEY"
{:error, %HTTPoison.Error{id: nil, reason: :nxdomain}}

iex(11)> HTTPoison.get "/v1/exchangerate/BTC?apikey=MYAPIKEY"      
** (CaseClauseError) no case clause matching: []
    (hackney) /home/tbrowne/code/crypto/deps/hackney/src/hackney_url.erl:192: :hackney_url.parse_netloc/2
    (hackney) /home/tbrowne/code/crypto/deps/hackney/src/hackney.erl:331: :hackney.request/5
    (httpoison) lib/httpoison/base.ex:439: HTTPoison.Base.request/9

Do you have something for Erlang or Elixir in the pipeline? I know for sure Erlang is used quite heavily in finance, and Elixir is gaining traction. Obviously I have changed MYAPIKEY to my real API key.

Hi a little help needed.

Hi thank YOU, This is the thing i was looking for 2 days now i have found it.
I have a slight problem can you tell me how i can get the price only from this api
https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,ETH&tsyms=USD,EUR&api_key=2854a5c3399c288c9183d204216c9c5d706e7d55bb64cd5a67eda10db684a574
https://min-api.cryptocompare.com/documentation?key=Price&cat=multipleSymbolsPriceEndpoint&api_key=2854a5c3399c288c9183d204216c9c5d706e7d55bb64cd5a67eda10db684a574
Please help me.
thanks

name and id are reversed for IOTA?

I downloaded all the assets available on coinapi just now using this URL: https://rest.coinapi.io/v1/assets.

Here is the raw JSON for IOTA (MIOTA):

{
	"asset_id": "IOTA",
	"name": "MIOTA",
	"type_is_crypto": 1,
	"data_start": "2017-06-13",
	"data_end": "2018-08-23",
	"data_quote_start": "2017-06-13T16:51:17.1775282Z",
	"data_quote_end": "2018-08-23T21:03:51.0029903Z",
	"data_orderbook_start": "2017-06-13T16:51:17.1775282Z",
	"data_orderbook_end": "2018-08-23T21:03:51.0029903Z",
	"data_trade_start": "2017-06-13T16:51:20.0000000Z",
	"data_trade_end": "2018-08-23T21:05:37.0000000Z",
	"data_trade_count": 27072757,
	"data_symbols_count": 25
},

Note that coinapi is claiming that the asset_id (i.e. symbol) is IOTA while the name is MIOTA.

I think that that is reversed!

For example, checkout this page: https://coinmarketcap.com/currencies/iota/. Note how it puts MIOTA in parentheses, which is what coinmarketcap does for ids, not names.

Of all the assets that downloaded from coinapi, I checked the top 10 crypto currencies by market cap, and only IOTA has this error.

New SendHelloMessage doesn't seem to update symbol subscriptions

I have implemented the CoinAPI SDK websocket client for C# - having some issues with subsequent SendHello messages to update the subscribed trade update symbols.

The initial SendHelloMessage works and i receive updates for any symbols contained in subscribe_filter_symbol_id. But if I try to update my subscriptions with new symbols via a subsequent SendHello it seems to be ignored and I continue receiving trade updates for the original subscribe_filter_symbol_id list.

Fatal Error with use of GetTwitterLatest function

Hello,

Any ideas why this happens?

Error:
PHP Fatal error: Uncaught Error: Wrong parameters for Exception([string $message [, long $code [, Throwable $previous = NULL]]]) in /coinapi.inc.php:379
Stack trace:
#0 /coinapi.inc.php(379): Exception->__construct(Object(stdClass))
#1 /coinapi.inc.php(311): CoinAPI->CurlRequest('https://rest.co...')
#2 /getLatest.php(17): CoinAPI->GetTwitterLatest(200)
#3 {main}
thrown in /coinapi.inc.php on line 379

Code:
require_once('coinapi.inc.php');

$api_key = "myAPIkeyHere";
$period_id = '1HRS';
$time_start = (new DateTime())->modify('-7 days');
$time_end = (new DateTime())->modify('-5 days');
$limit = 200;

$capi = new CoinAPI($api_key);

foreach($capi->GetTwitterLatest($limit) as $data) {

echo $data->id;
}

Thank you in advance.

[Feature Request] streaming SDK for OEML?

CoinAPI provides OEML as REST, websocket & FIX and yet only a generated REST API is available.

Are there plans for an OEML socket streaming SDK similar to the ones listed for the data web streaming?

Related to that, OEML has been labeled as "public beta", is there a rough ETA for release i.e. Q4 or next year?

OEML Docker container hangs in crashloop

Trying to start the OEML docker container according to the manual,
but no matter what I try, the container hangs in a crashloop.

On Windows (Powershell)

Using the parameter, as documeted.

docker run -d --name=BINANCE --restart=always --net=host coinapi/oeml-api --OEML:ExchangeId BINANCE  --OD:PublicApiKey key_string  --OD:PrivateApiKey key string --CoinAPI:ApiKey key_string 

Using config file, as documented:

docker run -d --name=BINANCE --restart=always --net=host coinapi/oeml-api --env-file oeml.env

oeml.env was created using:

cat > oeml.env << EOF

OEML__ExchangeId=BINANCE
CoinAPI__ApiKey=key_string

OD__PublicApiKey=key_string 
OD__PrivateApiKey=key_string 

EOF

key_string does not contain any whitespaces nor underscores.

From the documentation,
Docker_Error_Log.txt
key / value pairs for env. variable must be:

  • Strings
  • Colons must be replaced by double underscore __
  • Seperated by an equal sign

Which I translate to:

KEY__ID=VALUE

However, the above format seems to trigger an exception when trying to parse the key/value string.

When printing out the docker logs, I see the following exception :

shutting down...
TODO - ThreadedSocketAcceptor.WaitForLogout not implemented!
[03:42:17 FTL] Host terminated unexpectedly
System.FormatException: Unrecognized Guid format.
   at System.Guid.GuidResult.SetFailure(Boolean overflow, String failureMessageID)
   at System.Guid.TryParseGuid(ReadOnlySpan`1 guidString, GuidResult& result)
   at System.Guid.Parse(String input)
   at CoinAPI.OEML.API.LicenseService.CreateApikeyUsageOEML() in /src/CoinAPI.OEML.API/LicenseService.cs:line 131

Practically speaking, how do I format the API keys to get the service up & running?

Thank you

Returned Data have a lot of Redundant commas

When I using the free key request the BTC data,returned data have a lot of redundant commas ,like this.

{
    "time_period_start": "2019-08-25T12:00:00.0000000Z",
    "time_period_end": "2019-08-25T13:00:00.0000000Z",
    "time_open": "2019-08-25T12:00:07.5240000Z",
    "time_close": "2019-08-25T12:59:47.2180000Z",
    "price_open": 1013,0.000000000, // here 
    "price_high": 10355.890000000,
    "price_low": 10113.180000000,
    "price_close": 10317.010000000,
    "volume_traded": 478.267948660,
    "trades_count": 869
  },
  {
    "time_per,iod_start": "2019-08-25T14:00:00.0000000Z", // here
    "time_period_end": "2019-08-25T15:00:00.0000000Z",
    "time_open": "2019-08-25T14:00:10.1020000Z",
    "time_close": "2019-08-25T14:59:36.9410000Z",
    "price_open": 10260.570000000,
    "price_high": 10272.000000000,
    "price_low": 9977.240000000,
    "price_close": 10050.000000000,
    "volume_traded": 526.659400560,
    "trades_count": 1159
  },
  {
    "time_period_start": "2019-08-25T15:00:00.0000000Z",
    "time_period_end": "2019-08-25T16:00:00.0000000Z",
    "time_open": "2019-08-25T15:00:17.431,0000Z", // here
    "time_close": "2019-08-25T15:59:27.2940000Z",
    "price_open": 10050.000000000,
    "price_high": 10109.750000000,
    "price_low": ,10043.290000000, // here 
    "price_close": 10062.280000000,
    "volume_traded": 145.783488210,
    "trades_count": 328
  }

[Help] - Regarding "Reached maximum allowed buffered messages for this connection." error

Hello, would like to bring up this issue where the error maximum allowed buffered messages is received.

For our procedure, we are purely enqueueing (using ConcurrentQueue) the data received from websocket under Trade message and still receiving the mentioned error.

image

It should also be noted that we are not doing any processing and just purely receiving data. Also when using ConcurrentQueue, it can process 1 million data in around 20 milliseconds, so it shouldn't cause a bottleneck when processing data received.

For the datacenter, we are using Azure VM and that the network bandwidth is very high and is located in Singapore Region.

Edit: Additional Question: What does the error "The operation was canceled." mean when it is received?

Golang data streaming API - Requesting volume data closes connection with error 1006

Issue related to PR #108

Requesting data streams using Golang works for all message types except volume data. When constructing a hello message requesting only volume data, the connection terminates with error 1006. It is unclear to me why all other data types work as expected while requesting volume continues to throw that error. I am still investigation this error, but any help to fix this would be apricated.

An isolated test replicating this issue is part of the PR.
#108

Cannot import CoinAPIv1 with Python

Hello folks,

Here is my commands list

cd <project>
virtualenv <project_env>
source ./<project_env>/bin/activate
pip3 install coinapi.rest.v1 # no issue here
git clone https://github.com/coinapi/coinapi-sdk/data-api/python-rest/coinapi_rest_v1
cd <coinapi-sdk/data/python/coinapi_rest_v1>
python example.py <API_KEY>

Which results in

Traceback (most recent call last): 
  File "examples.py", line 1, in <module>
    from coinapi_rest_v1 import CoinAPIv1
ImportError: cannot import name 'CoinAPIv1' from 'coinapi_rest_v1' (/home/user/Development/project/project_env/lib/python3.8

Tested on Arch (python 3.8.6) and Windows (python 3.9.0).

Go client high CPU load

Environment:
OS: Linux Mint 20.1
Kernel: 5.4.0-80-generic
CPU: Intel© Core™ i7-2600K CPU @ 3.40GHz × 4
Mem: 24 GB 

I'm testing the Go websocket client, but are having some issues. When subscribed to all trades (production feed):

  • Just receiving (no further processing) causes a CPU usage of 110-120%
  • After a while, the connection will close with either an Unexpected EOF or being closed because too many messages are buffered by the sender.

When running the C# websocket client (targeting net5.0) on the same environment and subscribing to all trades, the CPU usage is ~20-40% and it seems to be more stable.

When running the Python websocket client on the same environment, the CPU usage is ~35-50%

I would have assumed the Go client to be at least as efficient as the C# client and more efficient than Python. Any thoughts on this?

[Feature Request] Parse data in response headers

CoinAPI provides data on request limits, exchanges used in aggregation of OHLCV data, and possibly more that I'm not aware of in the response headers. As far as I can see, the response header is currently neither parsed nor stored. I think it would be good to capture that information, either by parsing it for the relevant request or by just giving the CoinAPIv1 class an attribute response_header and leaving it to the user to parse it. I have only looked at the Python SDK, but I imagine the other languages are similar.

Do you think this makes sense generally and one of the implementations above specifically? If so, I'm happy to make a PR for the Python SDK.

Java api BUG: binance and coinbase download different times (timezones?)

I have Java code which uses the coinapi Java code to download market data every day.

In particular, I use its java_rest_coin_api class.

The relevant part of my download code that uses coinapi are these 2 lines:

java_rest_coin_api c = new java_rest_coin_api(KEY);
java_rest_coin_api.timedata[] result = c.ohlcv_get_historical_timeseries(symbol_id, period_id, time_start, time_end, limit);

The time_start arg that I supply is always the java.sql.Timestamp that represents the next interval start time AFTER the last interval that I previously downloaded the day before.

The time_end arg that I supply is always the Timestamp that represents 2222-01-01T00:00:00Z (i.e. a far distant future time).

This protocol should ensure that I download all the recent data that I am missing up to BUT NOT BEYOND the present.

When I ran my download at ~21:00 EDT (i.e. about 45 minutes ago), the download for 1 hour intervals for binance BTC/USDT behaved as expected.

In particular, the start time of the last interval downloaded was 2018-07-27T01:00:00Z. That time is a UTC timezone value that corresponds to 21:00 EDT. It is UTC because coinapi says that it always uses that timezone: "All time values we provide are UTC time zone. Do not assume otherwise." See: https://docs.coinapi.io/#time

In contrast, when I immediately ran the same code to download coinbase BTC/USD data, it behaved incorrectly.

In particular, the start time of the last interval downloaded was 2018-07-27T05:00:00Z. That date is 5 hours in the future, so it is obviously wrong!

Does anyone know what is going on?

My guess: coinapi is incorrectly converting coinbase timestamps. In particular, coinapi is assuming that the raw values it is getting from coinbase are in UTC−04:00 when in fact they are actually already in UTC. So, coinapi is mistakenly adding 4 hours to them to convert them to what it thinks should be UTC.

If true, this indicates a serious bug in coinapi's internal code: they failed to write a DBC ("Design By Contract") check to insist that market data times can NEVER be in the future (barring small clock skew differences).

HTTP Error 500 when using time_end in orderbooks_historical_data

Hi guys,

the following code throws an HTTP 500 error when time_end is specified in the query parameters:

start = datetime.datetime(2017, 1, 1, 0, 1, 0).isoformat()
end = datetime.datetime(2017, 1, 1, 0, 5, 0).isoformat()

data_query = api.orderbooks_historical_data(
    symbol_id="COINBASE_SPOT_ETH_USD",
    query_parameters={'time_start': start,
                      'time_end': end,
                      'limit': 1000})

When time_end is not specified, it works.

Java api code defect: most (all?) of the inner classes in java_rest_coin_api should be top level

The Java API essentially has but a single top level class, namely, java_rest_coin_api.

(There is also a top level test class, java_rest_coin_api_test.java, which shows how to use the API.)

That single top level class, however, has tons of inner classes/enums like asset, exchange, etc.

I see no reason why all these inner objects are defined inside the same top level class. They are fundamental domain objects, therefore, each should be pulled out into its own top level class.

I quickly glanced at the csharp-rest directory in the coinai .zip file, and I see that has proper top level classes for stuff. Java is no different than C# in regards to how you should nest your classes, so why does the Java API have this unconventional design?

It is an annoying design because you now need to refer to classes with really long unreadable names like "java_rest_coin_api.timedata" when you should just be able to use "timedata".

Also, that java_rest_coin_api class is in the default (unnamed) package, but it should probably be in a named package like "com.coinapi" or something.

Bug in example code

When I run python examples.py I get a syntax error in coinapi_v1:

Traceback (most recent call last):
  File "examples.py", line 1, in <module>
    from coinapi_v1 import CoinAPIv1
  File "/coinapi-sdk/python-rest/coinapi_v1.py", line 196
    self.headers = {**self.DEFAULT_HEADERS, **headers, **header_apikey}

Java REST api `Period_identifier` enum is not public and cannot be accessed

I'm trying to use the java api and getting OHLCV historical data using the method ohlcv_get_historical_timeseries provided by the class io.coinapi.rest.REST_methods but the method needs the period of the time-series data to fetch. This argument is of the type io.coinapi.rest.Period_identifier which is not public and cannot be accessed from outside packages and results in compile errors if accessed and there's no way of calling this method!

I was wondering if I'm the first person who used this java api, since this code is committed around 10 months ago. Anyways is there something that I'm missing or this issue is really a problem?

P.S.
Apart from not sticking to Java naming conventions and some other structural problems of the code, the maven package with version 1.13 as mentioned in the documentation does not exist in maven central repository and I ended up using the version 1.2, however it seems it's the same code as the Git repo.

Java API questionable choice of Timestamp instead of Instant

The sole Java API class java_rest_coin_api uses an old class, java.sql.Timestamp, to represent all time instances.

That is a strange choice: this API does no interaction with databases at all, so why use a class from java.sql?

Java 8 introduced a new time API that blows away the old Java classes in every way I know of. If you are unfamiliar, check out this introduction..

In java_rest_coin_api, I think that every current use of Timestamp should be replaced by the new Java time API class Instant.

C# Websocket - HeartbeatWatcher Method - _hbTimeout as configurable

Is there a way to modify the _hbTimeout as configurable? It looks like the 10 secs is very fragile and we are hitting always the operation cancelled exception.

Details:

Message: The operation was canceled.
Exception type: System.OperationCanceledException
Failed method: CoinAPI.WebSocket.V1.WSUtils+<ReceiveMessage>d__1.MoveNext

Stack Trace:

System.OperationCanceledException:
at System.Threading.CancellationToken.ThrowOperationCanceledException (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Net.WebSockets.WebSocketConnectionStream+d__21.MoveNext (System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Net.WebSockets.WebSocketBase+WebSocketOperation+d__19.MoveNext (System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Net.WebSockets.WebSocketBase+d__45.MoveNext (System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at CoinAPI.WebSocket.V1.WSUtils+<ReceiveMessage>d__1.MoveNext (CoinAPI.WebSocket.V1, Version=1.6.7.0, Culture=neutral, PublicKeyToken=null) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at CoinAPI.WebSocket.V1.CoinApiWsClient+d__45.MoveNext (CoinAPI.WebSocket.V1, Version=1.6.7.0, Culture=neutral, PublicKeyToken=null)

Help, are there any working examples of connecting in ws using coinapi sdk (C#)?

Tried testing the coinapi sdk for websocket. Followed the one in the repo, and able to get the log connected already but no data is received in TradeEvent. Are there other examples to follow?

Code I used:

` Hello helloMessage = new Hello()
{
apikey = Guid.Parse("api key"),
subscribe_data_type = new string[] { "trade" },
subscribe_filter_symbol_id = new string[] { "COINBASE_"},
subscribe_filter_exchange_id = new string[] { "COINBASE" }
};

        using (CoinApiWsClient wsClient = new CoinApiWsClient(true))
		{
            wsClient.TradeEvent += (s, e) =>
            {
                try
				{
                    Debug.WriteLine($"{e.ToString()}");
                    Debug.WriteLine($"{s.ToString()}");
				}
                catch (Exception ex)
				{
                    Debug.WriteLine(ex.Message);
                }
            };

            wsClient.Error += (s, e) =>
            {
                Debug.WriteLine($"e.InnerException, CoinApi Websocket - Error: {e.Message}");
            };

            wsClient.SendHelloMessage(helloMessage);

            if (wsClient.ConnectedEvent.WaitOne(TimeSpan.FromSeconds(5)))
            {
                Debug.WriteLine("Connected already");
            }
        } `

Error handling in Ruby SDK

When calling some methods from the SDK, like Client#exchange_rates_get_specific_rate, there are some edge cases - in particular, the test API Key has no access to the "specific exchange rate" endpoint, so it gets a 403.

But the method still tries to parse the date before returning the object, which results in an obscure "nil can't be parsed" sort of error.

Many such details exist.

Does the SDK intend to pass the message object with the error?

Does this coinapi API support keep alive and HTTP 1.1

Hello,

I was looking through the NodeJS SDK that we use and I realized that it doesnt use keep alive.
Is it an oversight ? Does this API support keep alive with HTTP 1.1 to do parallel requests ?
Our infra is deployed on Azure and we are trying the reduce the number of outbound connections to prevent SNAT port exhaustions.

Thank you,

Do you have a working example in Java?

Hey,

I am learning android development, just want to try to showing users a list of crypto-currency , Is there anyway you could provide example how to get the info?

Thanks.
PS
this API is cool

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.