Alt currency trading application built on the Origin framework.
tradeview consists of modules, accessible from the navigation panel on the left, including Configuration, Trading, Strategies and the Dashboard.
The Configuration module is where configuration for trading accounts, running strategies and strategy servers is managed.
- Manage Accounts allows you to create and persist trading accounts including account name, exchange, api key and secret key. It also persists display preferences for the trading screen, such as favourite symbols, and default selected symbol.
- Manage Strategies persists configuration for running a trading strategy and displaying a running strategy in realtime.
- Manage Servers persists trade server details for servers that run trading strategies
The Trading module shows a list of trading accounts in the navigation panel. Selecting an account will open a trading document in the main window for that account. From the trading document you can:
- see the account's balances
- view realtime pricing of favourite symbols
- select a symbol to subscribe to live orderbook and trade feed
- place buy and sell orders
- monitor and manage open orders in realtime
Strategies are run on an instance of tradeserver and can be monitored by one or more users. It is possible to update a running strategy's parameters in realtime e.g. buy and sell triggers or suspend trading. See Running a Strategy.
The dashboard shows all configured tradeservers and whether they are active. An active tradeserver will show the strategies currently running on it, including each strategy's parameters and its active connections i.e. which users are monitoring the strategy. See Running a Strategy.
Strategies are run on an instance of tradeserver, currently a private repository.
tradeview is intended to trade against multiple exchanges and the following api's are currently supported:
To add a new api create a new .NET Standard project for the API wrapper and create a class that implements IExchangeApi. For example see BinanceExchangeApi.
namespace DevelopmentInProgress.TradeView.Api.Binance
{
public class BinanceExchangeApi : IExchangeApi
{
public async Task<Order> PlaceOrder(User user, ClientOrder clientOrder)
{
var binanceApi = new BinanceApi();
using (var apiUser = new BinanceApiUser(user.ApiKey, user.ApiSecret))
{
var order = OrderHelper.GetOrder(apiUser, clientOrder);
var result = await binanceApi.PlaceAsync(order).ConfigureAwait(false);
return NewOrder(user, result);
}
}
public async Task<string> CancelOrderAsync(User user, string symbol, string orderId, string newClientOrderId = null, long recWindow = 0, CancellationToken cancellationToken = default(CancellationToken))
{
var binanceApi = new BinanceApi();
var id = Convert.ToInt64(orderId);
using (var apiUser = new BinanceApiUser(user.ApiKey, user.ApiSecret))
{
var result = await binanceApi.CancelOrderAsync(apiUser, symbol, id, newClientOrderId, recWindow, cancellationToken).ConfigureAwait(false);
return result;
}
}
Next, add the exchange to the Exchange enum.
public enum Exchange
{
Unknown,
Binance,
Kucoin,
Test
}
Finally, return an instance of the new exchange from the ExchangeApiFactory.
public class ExchangeApiFactory : IExchangeApiFactory
{
public IExchangeApi GetExchangeApi(Exchange exchange)
{
switch(exchange)
{
case Exchange.Binance:
return new BinanceExchangeApi();
case Exchange.Kucoin:
return new KucoinExchangeApi();
default:
throw new NotImplementedException();
}
}
public Dictionary<Exchange, IExchangeApi> GetExchanges()
{
var exchanges = new Dictionary<Exchange, IExchangeApi>();
exchanges.Add(Exchange.Binance, GetExchangeApi(Exchange.Binance));
exchanges.Add(Exchange.Kucoin, GetExchangeApi(Exchange.Kucoin));
return exchanges;
}
}
Data can be persisted to any data source by creating a library with classes that implement the interfaces in DevelopmentInProgress.TradeView.Data.
And map the classes in the DevelopmentInProgress.TradeView.Wpf.Host.Unity.config file.
<alias alias="TradeViewConfigurationAccountsFile" type="DevelopmentInProgress.TradeView.Data.File.TradeViewConfigurationAccountsFile, DevelopmentInProgress.TradeView.Data.File" />
<alias alias="TradeViewConfigurationStrategyFile" type="DevelopmentInProgress.TradeView.Data.File.TradeViewConfigurationStrategyFile, DevelopmentInProgress.TradeView.Data.File" />
<alias alias="TradeViewConfigurationServerFile" type="DevelopmentInProgress.TradeView.Data.File.TradeViewConfigurationServerFile, DevelopmentInProgress.TradeView.Data.File" />
<register type="ITradeViewConfigurationAccounts" mapTo="TradeViewConfigurationAccountsFile"/>
<register type="ITradeViewConfigurationStrategy" mapTo="TradeViewConfigurationStrategyFile"/>
<register type="ITradeViewConfigurationServer" mapTo="TradeViewConfigurationServerFile"/>