Giter Site home page Giter Site logo

kyapp69 / exchangesharp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from digitalruby/exchangesharp

0.0 1.0 0.0 15.76 MB

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.

Home Page: https://www.digitalruby.com

License: MIT License

C# 99.94% Shell 0.06%

exchangesharp's Introduction

Project's logo

Build Status NuGet

Overview

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

Feel free to visit the discord channel at https://discord.gg/sHCUHH3 and chat with other developers.

Features

  • Many exchanges supported with public, private and web socket API
  • Easy to use and well documented 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 from many different C# platforms
  • Has a great CLI 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 = order book, O = private orders, U = user data)

Exchange Name Public REST Private REST Web Socket Notes
Aquanow wip x
Binance x x T R B U
Binance Jersey x x T R B U
Binance.US x x T R B U
Binance DEX R
Bitbank x x
Bitfinex x x T R O
Bithumb x
BitMEX x x R O
Bitstamp x x R
Bittrex x x T R
BL3P x x R B Trades stream does not send trade's ids.
Bleutrade x x
BTSE x x
Bybit x x R Has public method for Websocket Positions
Coinbase x x T R U
Digifinex x x R B
FTX x x T
gate.io x x
Gemini x x T R B
HitBTC x x R
Huobi x x R B
Kraken x x R Dark order symbols not supported
KuCoin x x T R
LBank x x
Livecoin x x
NDAX x x T R
OKCoin x x R B
OKEx x x R B O
Poloniex x x T R B
YoBit x x
ZB.com wip R

The following cryptocurrency services are supported:

  • Cryptowatch (partial)

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

ExchangeAPI.GetExchangeAPIAsync.

Installing the CLI

On *nix systems:

  • Run this command curl https://github.com/jjxtra/ExchangeSharp/raw/master/install-console.sh | sh

On Windows (or manually):

  • Download the latest binaries for your OS.
  • Unzip it into a folder that is in your environment variable PATH (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 uses marketSymbol 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.

Building/Compiling

Websockets

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

ExchangeSharp.ClientWebSocket.RegisterWebSocketCreator(
    () => new ExchangeSharpConsole.WebSocket4NetClientWebSocket()
);

See WebSocket4NetClientWebSocket.cs for implementation details.

Nuget

dotnet CLI

dotnet add package DigitalRuby.ExchangeSharp --version 0.9.1

Package Manager on VS

PM> Install-Package DigitalRuby.ExchangeSharp -Version 0.9.1

Examples

Creating an order

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

Getting ticker info via Web Sockets

public static async Task Main(string[] args)
{
    // create a web socket connection to Binance. Note you can Dispose the socket anytime to shut it down.
    using var api = await ExchangeAPI.GetExchangeAPIAsync<ExchangeBinanceAPI>();
    // the web socket will handle disconnects and attempt to re-connect automatically.
    using var socket = await api.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 orers require you to call LoadApiKeys 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 internally currently. To log, use ExchangeSharp.Logger.

Do not use Console.WriteLine to log messages in the lib project.

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

Caching

The ExchageAPI class provides a method caching mechanism. Use MethodCachePolicy to put caching behind public methods, or clear to remove caching. Some methods are cached by default. You can set ExchangeAPI.UseDefaultMethodCachePolicy to false 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 the contributing guideline before submitting a pull request.

Consulting

I'm happy to make customizations to the software for you and keep in private repo, email [email protected].

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
[email protected]
http://www.digitalruby.com

exchangesharp's People

Contributors

basman avatar bezysoftware avatar bichuga avatar bobdecuir avatar brigb123 avatar bz-co avatar christso avatar emergentcybernetics avatar gajewskiarek avatar jacobjthompson avatar jazzonaut avatar jdx-john avatar jirapong avatar jjxtra avatar joemphilips avatar johnnyasantoss avatar kukks avatar kyapp69 avatar lordofdoom avatar ofekw avatar onurselcuk avatar paradoxforge avatar peixer avatar plumbly avatar revetter avatar superhappychris avatar szmcdull avatar username77 avatar vslee avatar wukan1986 avatar

Watchers

 avatar

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.