thefirstock 3.0.1

dotnet add package thefirstock --version 3.0.1
                    
NuGet\Install-Package thefirstock -Version 3.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="thefirstock" Version="3.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="thefirstock" Version="3.0.1" />
                    
Directory.Packages.props
<PackageReference Include="thefirstock" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add thefirstock --version 3.0.1
                    
#r "nuget: thefirstock, 3.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package thefirstock@3.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=thefirstock&version=3.0.1
                    
Install as a Cake Addin
#tool nuget:?package=thefirstock&version=3.0.1
                    
Install as a Cake Tool

The Firstock Connect API C# client - v3

To communicate with the Firstock Connect API using C#, you can use the official C# client library provided by Firstock. <br /> Licensed under the MIT License.

Version

Version - 3.0.1

Documentation

  • C# client documentation

v3 - Changes

  • Error code response structured has been changed
  • Renamed

Installing the client

Use the package manager nuget to install thefirstock.

dotnet add package thefirstock

API usage

using thefirstock;

class Program
{
public static void Main()
{
    Firstock firstock = new Firstock();
    """ Login using firstock account"""
    Firstock firstock = new Firstock();
    var result = firstock.login(
        userId: "",
        password: "",
        TOTP: "",
        vendorCode: "",
        apikey: ""
        );
    """Place an order"""
    var result = firstock.placeOrder(
        exchange: "NSE",
        tradingSymbol: "ITC-EQ",
        quantity: "1",
        price: "240",
        product: "C",
        transactionType: "B",
        priceType: "LMT",
        retention: "DAY",
        triggerPrice: "",
        remarks: "Strategy1");
    """Fetch single order deatils"""
    var result = firstock.singleOrderHistory(orderNumber: "");
    """Order book"""
    var result = firstock.orderBook();
    """Cancel order"""
    var result = firstock.cancelOrder(orderNumber: "");
    """Historical data"""
    var result = firstock.timePriceSeries(
        exchange: "NSE",
        token: "22",
        endTime: "02/08/2022 15:30:08",
        startTime: "05/07/2022 10:30:08",
        intrv:"3"
      );
}
}

Refer to the Firstock Connect Documentation for the complete list of supported methods.

WebSocket usage

using thefirstock;

class Program
{
public static void Main()
{
//// Initializer ///
var exitEvent = new ManualResetEvent(false);
using (var client = firstock.initializeWebSocket())
{
    /// Establishment of connection for required symbol //
        client.MessageReceived.Subscribe(msg =>
        {
            /////Prints the message successfully////
            Console.WriteLine("Message received: " + msg);
            client.Send(firstock.subscribeFeedAcknowledgement("NSE|26000"));// Subscribe to NIFTY
            client.Send(firstock.subscribeFeedAcknowledgement("NSE|26009"));// Subscribe to BANKNIFTY
        });

        client.Start();
        client.Send(firstock.startWebsockets());
        exitEvent.WaitOne();
}
}
}

Changelog

Check release notes.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.1 303 3/19/2023
3.0.0 273 2/28/2023
2.0.2 485 10/18/2022
2.0.1 470 10/18/2022
2.0.0 498 9/28/2022
1.0.1 463 8/7/2022
1.0.0 427 8/7/2022