FinancialMarketSimulator.Forex
1.0.0.6
dotnet add package FinancialMarketSimulator.Forex --version 1.0.0.6
NuGet\Install-Package FinancialMarketSimulator.Forex -Version 1.0.0.6
<PackageReference Include="FinancialMarketSimulator.Forex" Version="1.0.0.6" />
paket add FinancialMarketSimulator.Forex --version 1.0.0.6
#r "nuget: FinancialMarketSimulator.Forex, 1.0.0.6"
// Install FinancialMarketSimulator.Forex as a Cake Addin
#addin nuget:?package=FinancialMarketSimulator.Forex&version=1.0.0.6
// Install FinancialMarketSimulator.Forex as a Cake Tool
#tool nuget:?package=FinancialMarketSimulator.Forex&version=1.0.0.6
Financial Market Simulator
The Financial Market Data Simulator is a versatile tool designed to generate synthetic market data across various financial markets. By providing ticker symbols and their corresponding initial values, coupled with a defined publish frequency, this library empowers users to effortlessly simulate market conditions and trends. Whether you're working on algorithmic trading strategies, conducting market research, or testing financial applications, the Financial Market Data Simulator offers a streamlined way to generate and work with dummy data.
Dependencies
- CsvObjectify
- PriceProducer
- Microsoft.Extennsions.Logging
Features
- Customizable: Define your own ticker symbols, initial values, and publish frequency to simulate market conditions and trends.
- Realistic: The Financial Market Data Simulator uses a random walk model to generate realistic market data.
- Efficient: Library uses PriceProducer that produces tick within PriceLimit configured internally for each ticker symbol.
- Operations: The library exposes operations to Start, Pause, Resume and Stop the publishing.
- Logging: The library uses Microsoft Extenstions for logging.
Working
Forex uses CsvObjectify to parse file for ticker symbols and their corresponding initial values. Each ticker symbol in the file is parsed into TickerDefinition. The library uses PriceProducer that produces tick within PriceLimit which created from TickerDefinition for each ticker symbol. Timers are configured for tickers with same publish frequency. On the timer elapsed event, a random variation is added to each ticker configured for that timer. Consuming application receives callback for each new ticker rate.
Usage
TickDefinition is the main class that defines a ticker symbol and its corresponding initial values. It is created either from a file or constructed manually. The file can have any name and extension, but needs to have the following header
CurrencyPair,Bid,Ask,Spread,PublishFrequencyInMs
Each TickerDefinition creates a PriceLimit - from PriceProducer - which is then used to generate random tick within the limit.
Spot relies on ISpot that exposes methods that can be used to get status of Publisher the current Tickers that are configured for publishing and some house keeping operations.
public interface ISpot
{
void Start();
void Pause();
void Resume();
void Stop();
void AddTickDefinition(TickDefinition tickDefinition);
string[] Ticks { get; }
TickDefinition this[string currencyPair] { get; }
State CurrentState { get; }
(string ccyPair, int frequency)[] GetScheduledTicks();
event OnTickUpdate OnTickUpdate;
}
Quick start
Create a new instance of Forex
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddLog4Net());
// Using file with ticker symbols and their corresponding initial values
// Uses CsvObjectify to parse file for ticker symbols and their corresponding initial values
ISpot spot = new Spot(loggerFactory, _testFilePath);
// Using TickerDefinition for EURUSD requested to be published every 1 second
ISpot spot = new Spot(loggerFactory, new List<TickerDefinition> { new TickerDefinition("EURUSD", 120.1234, 120.1238, 0.01, 1000) });
Register a callback
spot.OnTickUpdate += Spot_OnTickUpdate;
// new tic is returned as string with format "Ticker : Bid, Ask, Last"
private async Task Spot_OnTickUpdate(string tickData)
{
_logger.LogInformation(tickData + " " + DateTime.Now.ToString("HH:mm:ss.fff"));
}
Start publishing
spot.Start();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- CsvObjectify (>= 1.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- PriceProducer (>= 1.0.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.