Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

ExchangeSharp is a powerful, fast and easy to use .NET/C# API for interfacing with many crypto currency exchanges. REST and web sockets are supported.

License

NotificationsYou must be signed in to change notification settings

DigitalRuby/ExchangeSharp

Repository files navigation

Project's logo

Github Sponsorship

NuGet

Overview

ExchangeSharp is a C#framework/lib andconsole app for trading and communicating withvarious exchange API end points for cryptocurrency assets. Many exchanges are supported, along withweb sockets, withdraws and more!

Feel free to visit the discord channel athttps://discord.gg/58ktxXuTVK and chat with other developers.

Features

  • Manyexchanges supported with public, private and web socket API
  • Easy to use code and API
  • Optional global market symbol normalization, since each exchange has their own way of doing market symbols
  • Runs anywhere .NET runs. (Windows, Mac, Linux, Containers, Serverless, iOS, Android,etc.)
  • Can be used frommany different C# platforms
  • Has a greatCLI that enables you to use all features from all exchanges right from your command line.

Exchanges

The following cryptocurrency exchanges are supported:
(Web socket key: T = tickers, R = trades, B = orderbook / delta orderbook, O = private orders, U = user data)

Exchange NamePublic RESTPrivate RESTWeb SocketNotes
ApolloXxxT R B O U
Aquanowwipx
BinancexxT R B O U
Binance JerseyxxT R B O UCeased operations
Binance.USxxT R B O U
Binance DEXR
Bitbankxx
BitfinexxxT R O
BitflyerR
BithumbxR
BitMEXxxR O
BitstampxxR
BittrexxxT R
BL3PxxR BTrades stream does not send trade's ids.
Bleutradexx
BtcTurkR
BTSExx
BybitxxR BHas public method for Websocket Positions
Coinbase (Advanced)xxT R O U
CoincheckR
Coinmatexx
Crypto.comR
DigifinexxxR B
DydxR
FTXxxT R
FTX.usxxT R
gate.ioxxR
GeminixxT R B
HitBTCxxR
HuobixxR B
KrakenxxRDark order symbols not supported
KuCoinxxT R B
LBankxxR
Livecoinxx
MEXCxxB
NDAXxxT R
OKCoinxxR B
OKExxxT R B O
PoloniexxxT R B
UPbitR
YoBitxx
ZB.comwipR

The following cryptocurrency services are supported:

  • Cryptowatch (partial)

Exchange constructors are private, to get access to an exchange in code use:

ExchangeAPI.GetExchangeAPIAsync<T>().

Installing the CLI

On *nix systems:

  • Run this commandcurl https://github.com/DigitalRuby/ExchangeSharp/raw/main/install-console.sh | sh

On Windows (or manually):

  • Download thelatest binaries for your OS.
  • Unzip it into a folder that is in your environment variablePATH (ctrl +shift +pause|break -> Environment Variables)
  • Use it from your preferred command-line emulator (e.g. Powershell, cmd, etc.)
  • exchange-sharp --help shows all available commands

Notes

ExchangeSharp usesmarketSymbol to refer to markets, or pairs of currencies.

Please send pull requests if you have made a change that you feel is worthwhile, want a bug fixed or want a new feature. You can also donate to get new features.

Websockets

If you must use an older Windows (older than win8.1), you'll need to use theWebsocket4Net nuget package, and override the web socket implementation by calling

ExchangeSharp.ClientWebSocket.RegisterWebSocketCreator(()=>newExchangeSharpConsole.WebSocket4NetClientWebSocket());

SeeWebSocket4NetClientWebSocket.cs for implementation details.

Nuget

dotnet CLI

dotnet add package DigitalRuby.ExchangeSharp --version 1.2.0

Package Manager on VS

PM> Install-Package DigitalRuby.ExchangeSharp -Version 1.2.0

Examples

Creating an order

There's a lot of examples on how to use the API in ourconsole application.
e.g.ExampleOption.cs

Getting ticker info via Web Sockets

publicstaticasyncTaskMain(string[]args){// create a web socket connection to Binance. Note you can Dispose the socket anytime to shut it down.usingvarapi=awaitExchangeAPI.GetExchangeAPIAsync<ExchangeBinanceAPI>();// the web socket will handle disconnects and attempt to re-connect automatically.usingvarsocket=awaitapi.GetTickersWebSocket(tickers=>{Console.WriteLine("{0} tickers, first: {1}",tickers.Count,tickers.First());});Console.WriteLine("Press ENTER to shutdown.");Console.ReadLine(true);}

Authentication

Private api calls like placing orders require you to callLoadApiKeys first. You can generate an api keys file by running the bundled console application and choosing the generate key file option.

Logging

ExchangeSharp uses NLog internallycurrently. To log, useExchangeSharp.Logger.

Donot useConsole.WriteLine to log messages in the lib project.

Provide your ownnlog.config orapp.config nlog configuration if you want to change logging settings or turn logging off.

Caching

TheExchageAPI class provides a method caching mechanism. UseMethodCachePolicy to put caching behind public methods, or clear to remove caching. Some methods are cached by default. You can setExchangeAPI.UseDefaultMethodCachePolicy tofalse to stop all caching as well.

You can also set request cache policy if you want to tweak how the http caching behaves.

How to contribute

Please read thecontributing guidelinebefore submitting apull request.

Consulting

I'm happy to make customizations to the software for you and keep in private repo, emailexchangesharp@digitalruby.com.

Donations Gratefully Accepted

Believe it or not, donations are quite rare. I've posted publicly the total donation amounts below. If ExchangeSharp has helped you in any way, please consider donating.

Donate with Bitcoin

Donate with Litecoin

Donate with Ethereum

Donate

Donation totals:0.039 BTC, 10.25 LTC

Thanks for visiting!

Jeff Johnson
jeff@digitalruby.com
http://www.digitalruby.com


[8]ページ先頭

©2009-2025 Movatter.jp