Giter VIP home page Giter VIP logo

alpaca-trade-api-csharp's Introduction

.NET SDK for Alpaca Markets API

.NET Core Usage Example

  1. Create a new console application in a new, empty folder by running dotnet new console.
  2. Add a reference for Alpaca .NET SDK with dotnet add package Alpaca.Markets.
  3. Change Main method in auto-generated Programm.cs file to this code snippet:
var client = new Alpaca.Markets.RestClient(
    KEY_ID, SECRET_KEY, API_URL);

var clock = client.GetClockAsync().Result;

if (clock != null)
{
    Console.WriteLine(
        "Timestamp: {0}, NextOpen: {1}, NextClose: {2}",
        clock.Timestamp, clock.NextOpen, clock.NextClose);
}
  1. Replace KEY_ID, SECRET_KEY and API_URL values with your own data from the Alpaca dashboard.
  2. Run the sample application using dotnet run command and check the output. You should see information about the current market timestamp and the times that the market will open and close next.

Mapping between branches and SDK versions

Branch Version Description
develop 3.5.* New features, breaking changes
master 3.4.* All new features and hot-fixes
support/v3.3.x 3.3.* Hot fixes only, some features

Release-specific changes in SDK

Use .NET Core configuration

Starting from version 1.1.0 you can use the IConfiguration interface for providing configuration data to constructors. You can read more about the new .NET Core configuration approach in this article. Please also read the appropriate Wiki pages about expected configuration parameters for each constructor.

Assembly signing in NuGet package

Starting from version 1.2.3 and 2.0.0 NuGet packages contains strongly signed assemblies only for .NET Standard 1.6 and 2.0 targets. .NET Framework 4.5 version of Alpaca.Markets.dll is packaged unsigned because a dependent assembly, NATS.Client.dll, also shipped unsigned.

Polygon NATS client deprecation

Polygon is deprecating their NATS streaming in favor of Websockets, and they have finally made it possible for Alpaca users to switch to the websocket endpoint. Starting from version 3.2.0-beta2 we mark NatsClient class with Obsolete attribute and any usage of this class will generate warning for now. Recommended way for obtaining real-time data now is PolygonSockClient usage (it provides very similar interface so transition should be easy). In upcoming minor release (most probably 3.3.0) NatsClient will be marked as Obsolete with error generation and in upcoming major release (4.0.0) it will be removed from SDK completely.

alpaca-trade-api-csharp's People

Contributors

biyimaks avatar elektromech avatar olegra avatar ronmenator avatar schmich avatar ttt733 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.