Skip to content

TradeSharp Backend code. TradeSharp is a C# based data feed and broker neutral Algorithmic Trading Platform that lets trading firms or individuals connect to providers, and automate any rules based trading strategies in stocks, forex and ETFs.

License

w1r2p1/tradesharp-core

 
 

Repository files navigation

IMPORTANT

This is an old project and hasn't been actively maintained since 2015 and we're not providing any paid support for it.

TradeSharp

TradeSharp is a C# based data feed and broker neutral Algorithmic Trading Platform that lets trading firms or individuals automate any rules based trading strategies in stocks, forex and ETFs.

Find more about TradeSharp here.


Table of contents


Installation

Download and install the following tools to setup development environment for working with TradeSharp.

  1. Microsoft Visual Studio 2012 or higher
  2. .NET Framework 4.5.1
  3. MySQL
  4. Git
  5. Wix
  6. RabbitMQ
  7. Resharper (Visual Studio extension for .NET Developers )
  8. SourceTree (GIT client for windows)

Code Cloning

It is highly recommended that you clone the TradeSharp repositories in C:\trade-nexus directory as doing so would make things easier when creating the TradeSHarp installer.

  1. Clone TradeSharp backend (tradesharp-core):
  2. Clone TradeSharp frontend (tradesharp-ui):

Assumptions:

It is assumed in the remianing document that the location for tradesharp-core (TradeSharp Backend) is C:\trade-nexus\tradesharp-core and location for tradesharp-ui (TradeSharp Frontend) is C:\trade-nexus\tradesharp-ui.

Setting Up Database

  1. Create a new database named Tradehub.
  2. Settings:
    • UserName: root
    • Password: root
    • Host: localhost
  3. Run sql script C:\trade-nexus\tradesharp-ui\database\TradeHubDBScript.sql

To load data from workbench

  1. Open MySQL Workbench
  2. Click on “Local Instance MySQL” and enter password when prompted
  3. From top menu bar, click on Server -> Import Data
  4. Select import from self-contained file and provide path to ‘TradeHubDBScript.sql’ file
  5. Select “TradeHub” as target schema
  6. Press ‘Start Import’ button
  7. Restart workbench to ensure tables are present in db

Opening Code With Visual Studio

  1. Run Visual Studio
  2. Click on File -> Open -> Project/Solution…
  3. In the new windows that opens, navigate to the tradesharp-core code cloned C:\trade-nexus\tradesharp-core\Backend
  4. Select TradeHub.sln
  5. Run another instance of Visual Studio
  6. Click on File -> Open -> Project/Solution…
  7. In the new windows that opens, navigate to tradesharp-ui code cloned C:\trade-nexus\tradesharp-ui
  8. Select TradeHubGui.sln

Enabling Test Code to Simulate Service Start

This step is important to perform before running TradeSharp locally without installer

  1. In Visual Studio instance with tradesharp-ui code, open TradeHubGui\ViewModel\ServicesViewModel.cs
  2. Find PopulateServices() method and then locate comments “//NOTE: Test code to simulate Service Start” “// BEGIN:”
  3. Uncomment the block of code that follows till “// :END” comment
  4. Locate comment “// Disbaled for testing” in the same method near the end and comment the line of code “InitializeServices();”
  5. Find StopService() method in the same file and repeat steps 2-3.
// ServicesViewModel.cs
...
private void PopulateServices()
{
...
   //NOTE: Test code to simulate Service Start
   // BEGIN:
        availableService.Status = ServiceStatus.Starting;
        availableService.Status = ServiceStatus.Running;
   // :END
   
   ////NOTE: To be disbaled for testing
   //InitializeServices();
}         
...
...
private void StopService(string serviceName)
{
...
 //NOTE: Test code to simulate Service Start
 // BEGIN:
      serviceDetails.Status = ServiceStatus.Stopping;
      serviceDetails.Status = ServiceStatus.Stopped;
      return;
 // :END
 }

Changing ROOT DIRECTORY PATH

This step is important to perform before running TradeSharp locally without installer

  1. In Visual Studio instance with tradesharp-ui code, open TradeHubGui\TradeHubGui.Common\Constants\DirectoryPath.cs
  2. Comment line public static string ROOT_DIRECTORY_PATH = Path.GetFullPath(@"~....");
  3. Uncomment line public static string ROOT_DIRECTORY_PATH = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\TradeHub\";
//public static string ROOT_DIRECTORY_PATH = Path.GetFullPath(@"~\..\..\");
//// NOTE: For running application locally
public static string ROOT_DIRECTORY_PATH = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\TradeHub\\";

Running Application

  1. Compiling Code (When running the code for the first time or after making changes)
    • Click on Build->Clean Solution from top menu bar
    • Click on Build->Build Solution
  2. Starting the Backend
    • In the Visual Studio instance with TradeSharp Backend code, locate and expand MarketDateEngine in the solution explorer.
    • Right click on TradeHub.MarketDataEngine.Server.Console
    • Click on Debug->Start new instance
    • If everything is fine a new console window should open up
    • Locate and expand OrderExecutionEngine
    • Right click on TradeHub.OrderExecutionEngine.Server.Console
    • Click on Debug->Start new instance
    • If everything is fine a new console window should open up
  3. Starting the tradesharp-ui
    • In Visual Studio instance with tradesharp-ui code, right click on TradeHubGui project and Set as startup project
    • Click on Start from the top menu bar

Viewing Logs

  1. Log Locations
    • TradeSharp Logs in ProgramData folder: (C:\ProgramData\TradeSharp Logs)
    • Note: ProgramData folder may be hidden
  2. Some log files are created in component Debug folders. For example after running MarketDataEngine Console, log file will be created in *C:\trade-nexus\tradesharp-core\Backend\MarketDataEngine\TradeHub.MarketDataEngine.Server.Console\bin\Debug*

Bugs

Please report bugs here

About

TradeSharp Backend code. TradeSharp is a C# based data feed and broker neutral Algorithmic Trading Platform that lets trading firms or individuals connect to providers, and automate any rules based trading strategies in stocks, forex and ETFs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.8%
  • Other 0.2%