61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using System;
|
|
using sharp.extensions;
|
|
using System.CodeDom;
|
|
using System.Collections.Generic;
|
|
namespace sharp.trading
|
|
{
|
|
public abstract class TradingConnection : MarshalByRefObject
|
|
{
|
|
public String UniqueProviderName { get; private set; }
|
|
|
|
public TradingConnection(string providerID)
|
|
{
|
|
UniqueProviderName = providerID;
|
|
}
|
|
|
|
public abstract object[] getConstructorArguments();
|
|
|
|
public abstract Currency[] getCurrencies();
|
|
public abstract Balance[] getBalances();
|
|
|
|
public abstract Market openMarket(string tradedSymbol, string payingSymbol);
|
|
public abstract Pair<string>[]
|
|
listMarkets();
|
|
|
|
public abstract Order[] getOpenOrders();
|
|
public abstract Order[] getHistoricOrders();
|
|
|
|
public abstract Order createOrder(OrderType orderType, OrderTarget orderTarget, string marketSymbol, string baseSymbol, double amount, double price);
|
|
public abstract Order getOrder(string orderID);
|
|
public abstract void cancelOrder(string orderID);
|
|
public abstract void refreshOrder(Order order);
|
|
|
|
public Currency getCurrency(string symbol){
|
|
foreach (Currency c in getCurrencies()){
|
|
if (c.Symbol.Equals(symbol)){
|
|
return c;
|
|
}
|
|
}
|
|
throw new NotSupportedException(String.Format("Currency '{0}' not supported by Bittrex",symbol));
|
|
}
|
|
|
|
public Market openMarket(Pair<string> pair){
|
|
return openMarket(pair.Item2, pair.Item1);
|
|
}
|
|
|
|
public Pair<string>[] getMarketsForSymbol(string symbol){
|
|
List<Pair<string>> r = new List<Pair<string>>();
|
|
foreach (Pair<string> p in listMarkets()){
|
|
if (p.Item1.Equals(symbol) || p.Item2.Equals(symbol)){
|
|
r.Add(p);
|
|
}
|
|
}
|
|
return r.ToArray();
|
|
}
|
|
|
|
public void cancelOrder(Order order){
|
|
cancelOrder(order.OrderID);
|
|
}
|
|
}
|
|
}
|