Code Monkey home page Code Monkey logo

threefourteen.finnhubclient's Introduction

ThreeFourteen Finnhub Client

A client that can be used to access Finnhub Market Data.

To use this library you will need to register with Finnhub and get hold of an API Key.

Please take a look at the Finnhub API Documentation to see what data is available.

Create the Client

Creating a client is very simple, all you need is the API key. If you would like to inject your own instance of HttpClient, there is an overload for the constructor (be sure not to set BaseAddress on the HttpClient).

// Without HttpClient
var client = new FinnhubClient(apiKey);

...

// With HttpClient
var client = new FinnhubClient(httpClient, apiKey);

Use the Client

To use the client it's a simple as using Intellisense to guide you. The API calls have been abstracted to be inline with the API documentation. Find the data you require and make the call.

// Stock
var company = await client.Stock.GetCompany("AAPL");
var compensation = await client.Stock.GetCompensation("AAPL");
var recommendations = await client.Stock.GetRecommendationTrends("AAPL");
var priceTarget = await client.Stock.GetPriceTarget("AAPL");
var peers = await client.Stock.GetPeers("AAPL");
var earnings = await client.Stock.GetEarnings("AAPL");
var exchanges = await client.Stock.GetExchanges();
var symbols = await client.Stock.GetSymbols("US");
var quote = await client.Stock.GetQuote("AAPL");
var candles = await client.Stock.GetCandles("AAPL", Resolution.Day, 10);

// Forex
var exchanges = await client.Forex.GetExchanges();
var symbols = await client.Forex.GetSymbols("fxcm");
var candles = await client.Forex.GetCandles(symbols.First().CandleSymbol, Resolution.Day, 10);

// Crypto
var exchanges = await client.Crypto.GetExchanges();
var symbols = await client.Crypto.GetSymbols("Binance");
var candles = await client.Crypto.GetCandles(symbols.First().CandleSymbol, Resolution.Day, 10);

There is a way to get hold of the raw response data for any call but you will have to managed deserialisation yourself (the response type is a string). This will allow the use of the client even when all the calls have not been implemented (yet).

// Get Raw Data
var rawData = await client.GetRawDataAsync("stock/profile", new Field(FieldKeys.Symbol, "AAPL"));

In Closing

The Author of this library is not affiliated with Finnhub, so please do not send questions on the data or the API to myself.

But if you do have any questions or changes you would like to see (for this library), please feel free to raise an issue. I can't guarantee it will be addressed instantly but I will get to it as soon as I can.

Please be aware that you use this library at your own risk and I take no responsibility for any defects (but I will try fix them if you ask nicely).

threefourteen.finnhubclient's People

Contributors

kevin-kavanagh avatar kevwk314 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.