Coder Social home page Coder Social logo

alamgirmunshi / alpaca-trade-api-csharp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alpacahq/alpaca-trade-api-csharp

0.0 1.0 0.0 5.03 MB

C# SDK for Alpaca Trade API https://docs.alpaca.markets/

License: Apache License 2.0

C# 100.00%

alpaca-trade-api-csharp's Introduction

Build Codacy Coverage Nuget

.NET SDK for Alpaca Markets API

Package Stable Pre-release
Alpaca.Markets Nuget Nuget
Alpaca.Markets.Extensions Nuget Nuget

.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. Replace content of the auto-generated Programm.cs file with this code snippet:
using System;
using Alpaca.Markets;
using System.Threading.Tasks;

namespace AlpacaExample
{
    internal static class Program
    {
        private const String KEY_ID = "";

        private const String SECRET_KEY = "";

        public static async Task Main()
        {
            var client = Environments.Paper
                .GetAlpacaTradingClient(new SecretKey(KEY_ID, SECRET_KEY));

            var clock = await client.GetClockAsync();

            if (clock != null)
            {
                Console.WriteLine(
                    "Timestamp: {0}, NextOpen: {1}, NextClose: {2}",
                    clock.TimestampUtc, clock.NextOpenUtc, clock.NextCloseUtc);
            }
        }
    }
}
  1. Replace KEY_ID and SECRET_KEY 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.

See the UsageExamples project for near-to-real-world strategy implementation using this SDK and the Alpaca.Markets.Tests repository for SDK usage examples. The Wiki pages contain a lot of additional information about different aspects of this SDK (environments handling, authentication types, different order placement approaches, streaming client subscriptions handling, etc.).

Alpaca Data API subscription plans

Alpaca provides 3 different subscription plans for the Data API v2 real-time streaming data: Free, Unlimited, and Business. The first one provides only IEX data and has some subscription limits. Other plans provide full SIP data without data subscription limits. The IAlpacaDataStreamingClient interface and its implementation from SDK provide unified access for both streams.

Use the Environments.Paper.GetAlpacaDataStreamingClient(...) factory method for creating client connected to the Free IEX data stream. For the Unlimited and Business SIP data stream use the Environments.Live.GetAlpacaDataStreamingClient(...) code. So Paper environment for free data tier and Live for paid subscriptions.

Mapping between branches and SDK versions

Branch Version Description Milestone
develop 6.0.x Unstable - experimental, can contain bugs SDK 6.0.x Experimental
master 5.x.x LTS - good choice for the new development SDK 5.x LTS
support/v4.1.x 4.x.x LTS - no new featues, security fixes only SDK 4.x LTS

alpaca-trade-api-csharp's People

Contributors

olegra avatar ttt733 avatar dependabot-preview[bot] avatar dependabot[bot] avatar elektromech avatar biyimaks avatar gjtorikian avatar ajit-kolathur avatar schmich avatar dav-id avatar prometheusuno avatar ronmenator avatar hard-coder05 avatar amwsis avatar

Watchers

James Cloos 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.