{"id":18843321,"url":"https://github.com/alpacahq/alpaca-trade-api-csharp","last_synced_at":"2025-05-16T05:04:33.841Z","repository":{"id":37470740,"uuid":"137755267","full_name":"alpacahq/alpaca-trade-api-csharp","owner":"alpacahq","description":"C# SDK for Alpaca Trade API https://docs.alpaca.markets/","archived":false,"fork":false,"pushed_at":"2025-04-21T09:22:13.000Z","size":7477,"stargazers_count":262,"open_issues_count":16,"forks_count":83,"subscribers_count":43,"default_branch":"main","last_synced_at":"2025-04-21T10:28:39.292Z","etag":null,"topics":["csharp","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alpacahq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["OlegRa"]}},"created_at":"2018-06-18T13:29:56.000Z","updated_at":"2025-04-21T09:22:18.000Z","dependencies_parsed_at":"2023-02-15T23:46:01.676Z","dependency_job_id":"625ac9e5-7bc3-4441-b777-764c24f7b210","html_url":"https://github.com/alpacahq/alpaca-trade-api-csharp","commit_stats":{"total_commits":1805,"total_committers":27,"mean_commits":66.85185185185185,"dds":"0.14570637119113572","last_synced_commit":"2a790c193b1972cc1985566a312fc26051c02ace"},"previous_names":[],"tags_count":517,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Falpaca-trade-api-csharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Falpaca-trade-api-csharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Falpaca-trade-api-csharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Falpaca-trade-api-csharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alpacahq","download_url":"https://codeload.github.com/alpacahq/alpaca-trade-api-csharp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471060,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","hacktoberfest"],"created_at":"2024-11-08T02:57:30.434Z","updated_at":"2025-05-16T05:04:33.823Z","avatar_url":"https://github.com/alpacahq.png","language":"C#","funding_links":["https://github.com/sponsors/OlegRa"],"categories":[],"sub_categories":[],"readme":"[![Contributors](https://img.shields.io/github/all-contributors/alpacahq/alpaca-trade-api-csharp?logo=github)](https://github.com/alpacahq/alpaca-trade-api-csharp/blob/main/CONTRIBUTORS.md)\n[![Build](https://github.com/alpacahq/alpaca-trade-api-csharp/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/alpacahq/alpaca-trade-api-csharp/actions)\n[![Codacy](https://img.shields.io/codacy/grade/7659cd4379964ef190a1088aa879350a?logo=codacy)](https://app.codacy.com/gh/OlegRa/Alpaca.Markets/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![Coverage](https://app.codacy.com/project/badge/Coverage/7659cd4379964ef190a1088aa879350a)](https://app.codacy.com/gh/OlegRa/Alpaca.Markets/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_coverage)\n[![Nuget](https://img.shields.io/nuget/dt/Alpaca.Markets?logo=NuGet)](https://www.nuget.org/stats/packages/Alpaca.Markets?groupby=Version)\n[![PVS-Studio](https://img.shields.io/badge/PVS--Studio-0-blue?logo=opensourceinitiative\u0026logoColor=white\u0026logoWidth=16)](https://pvs-studio.com/pvs-studio/?utm_source=website\u0026utm_medium=github\u0026utm_campaign=open_source)\n\n# .NET SDK for Alpaca Markets API\n\n| Package | Stable | Pre-release |\n| ------- | ------ | ----------- |\n| [Alpaca.Markets](https://olegra.github.io/Alpaca.Markets/api/Alpaca.Markets.html) | [![Nuget](https://img.shields.io/nuget/v/Alpaca.Markets?logo=NuGet)](https://www.nuget.org/packages/Alpaca.Markets) | [![Nuget](https://img.shields.io/nuget/vpre/Alpaca.Markets?logo=NuGet)](https://www.nuget.org/packages/Alpaca.Markets/absoluteLatest) |\n| [Alpaca.Markets.Extensions](https://olegra.github.io/Alpaca.Markets/api/Alpaca.Markets.Extensions.html) | [![Nuget](https://img.shields.io/nuget/v/Alpaca.Markets.Extensions?logo=NuGet)](https://www.nuget.org/packages/Alpaca.Markets.Extensions) | [![Nuget](https://img.shields.io/nuget/vpre/Alpaca.Markets.Extensions?logo=NuGet)](https://www.nuget.org/packages/Alpaca.Markets.Extensions/absoluteLatest) |\n\n## .NET Core Usage Example\n\n1.  Create a new console application in a new, empty folder by running `dotnet new console`.\n2.  Add a reference for Alpaca .NET SDK with `dotnet add package Alpaca.Markets`.\n3.  Replace the content of the auto-generated `Program.cs` file with this code snippet:\n```cs\nusing System;\nusing Alpaca.Markets;\nusing System.Threading.Tasks;\n\nnamespace AlpacaExample\n{\n    internal static class Program\n    {\n        private const String KEY_ID = \"\";\n\n        private const String SECRET_KEY = \"\";\n\n        public static async Task Main()\n        {\n            var client = Environments.Paper\n                .GetAlpacaTradingClient(new SecretKey(KEY_ID, SECRET_KEY));\n\n            var clock = await client.GetClockAsync();\n\n            if (clock != null)\n            {\n                Console.WriteLine(\n                    \"Timestamp: {0}, NextOpen: {1}, NextClose: {2}\",\n                    clock.TimestampUtc, clock.NextOpenUtc, clock.NextCloseUtc);\n            }\n        }\n    }\n}\n```\n4.  Replace the `KEY_ID` and `SECRET_KEY` values with your data from the Alpaca dashboard.\n5.  Run the sample application using the `dotnet run` command and check the output. You should see information about the current market timestamp and when the market will open and close next.\n\nSee the [UsageExamples](../../tree/main/UsageExamples) project for near-to-real-world strategy implementation using this SDK and the [Alpaca.Markets.Tests](https://github.com/OlegRa/Alpaca.Markets.Tests) repository for SDK usage examples. The [Wiki](https://github.com/alpacahq/alpaca-trade-api-csharp/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.).\n\n## Alpaca Data API subscription plans\n\nAlpaca provides three different subscription plans for the Data API v2 real-time streaming data: Free, Unlimited, and Business. The first one offers only IEX data and has some subscription limits. Other plans provide complete SIP data without data subscription limits. The `IAlpacaDataStreamingClient` interface and its implementation from SDK provide unified access for both streams.\n\nUse the `Environments.Paper.GetAlpacaDataStreamingClient(...)` factory method to create a client connected to the Free IEX data stream. Use the `Environments.Live.GetAlpacaDataStreamingClient(...)` code for the Unlimited and Business SIP data stream. So _Paper_ environment for free data tier and _Live_ for paid subscriptions.\n\n### Build instructions\n\n1.  Install your OS's latest version of the [.NET 9.0 SDK](https://dotnet.microsoft.com/download).\n2.  Clone the local version of this repository or your fork (if you want to make changes).\n3.  Build the packages using the `dotnet build` command running in the root directory of the cloned repo.\n\n## Contributors\n\nThanks a lot for all the contributors. See the complete list of project supporters in the [CONTRIBUTORS](https://github.com/alpacahq/alpaca-trade-api-csharp/blob/main/CONTRIBUTORS.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpacahq%2Falpaca-trade-api-csharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falpacahq%2Falpaca-trade-api-csharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpacahq%2Falpaca-trade-api-csharp/lists"}