Skip to content

Commit

Permalink
Added a missing API feature; fixed anonymous client initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojatekok committed Dec 2, 2014
1 parent 051ac01 commit da0871c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion PoloniexApi.Net.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoloniexApi.Net.Demo", "PoloniexApi.Net.Demo\PoloniexApi.Net.Demo.csproj", "{10D79671-870B-4088-9100-69E3CAAF364C}"
EndProject
Expand Down
8 changes: 7 additions & 1 deletion PoloniexApi.Net/MarketTools/Markets.Interface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ public interface IMarkets
/// <param name="depth">The number of orders to fetch from each side.</param>
Task<IOrderBook> GetOpenOrdersAsync(CurrencyPair currencyPair, uint depth = 50);

/// <summary>Fetches the last 200 trades for a given market.</summary>
/// <summary>Fetches the last 200 trades of a given market.</summary>
/// <param name="currencyPair">The currency pair, which consists of the currency being traded on the market, and the base's code.</param>
Task<IList<ITrade>> GetTradesAsync(CurrencyPair currencyPair);

/// <summary>Fetches the trades of a given market in a given time period.</summary>
/// <param name="currencyPair">The currency pair, which consists of the currency being traded on the market, and the base's code.</param>
/// <param name="startTime">The time to start fetching data from.</param>
/// <param name="endTime">The time to stop fetching data at.</param>
Task<IList<ITrade>> GetTradesAsync(CurrencyPair currencyPair, DateTime startTime, DateTime endTime);

/// <summary>Fetches the chart data which Poloniex uses for their candlestick graphs for a market view of a given time period.</summary>
/// <param name="currencyPair">The currency pair, which consists of the currency being traded on the market, and the base's code.</param>
/// <param name="period">The sampling frequency of the chart.</param>
Expand Down
22 changes: 19 additions & 3 deletions PoloniexApi.Net/MarketTools/Markets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private IDictionary<CurrencyPair, IMarketData> GetSummary()
);
}

public IOrderBook GetOpenOrders(CurrencyPair currencyPair, uint depth)
private IOrderBook GetOpenOrders(CurrencyPair currencyPair, uint depth)
{
var data = GetData<OrderBook>(
"returnOrderBook",
Expand All @@ -34,7 +34,7 @@ public IOrderBook GetOpenOrders(CurrencyPair currencyPair, uint depth)
return data;
}

public IList<ITrade> GetTrades(CurrencyPair currencyPair)
private IList<ITrade> GetTrades(CurrencyPair currencyPair)
{
var data = GetData<IList<Trade>>(
"returnTradeHistory",
Expand All @@ -43,7 +43,18 @@ public IList<ITrade> GetTrades(CurrencyPair currencyPair)
return new List<ITrade>(data);
}

public IList<IMarketChartData> GetChartData(CurrencyPair currencyPair, MarketPeriod period, DateTime startTime, DateTime endTime)
private IList<ITrade> GetTrades(CurrencyPair currencyPair, DateTime startTime, DateTime endTime)
{
var data = GetData<IList<Trade>>(
"returnTradeHistory",
"currencyPair=" + currencyPair,
"start=" + Helper.DateTimeToUnixTimeStamp(startTime),
"end=" + Helper.DateTimeToUnixTimeStamp(endTime)
);
return new List<ITrade>(data);
}

private IList<IMarketChartData> GetChartData(CurrencyPair currencyPair, MarketPeriod period, DateTime startTime, DateTime endTime)
{
var data = GetData<IList<MarketChartData>>(
"returnChartData",
Expand All @@ -70,6 +81,11 @@ public Task<IList<ITrade>> GetTradesAsync(CurrencyPair currencyPair)
return Task.Factory.StartNew(() => GetTrades(currencyPair));
}

public Task<IList<ITrade>> GetTradesAsync(CurrencyPair currencyPair, DateTime startTime, DateTime endTime)
{
return Task.Factory.StartNew(() => GetTrades(currencyPair, startTime, endTime));
}

public Task<IList<IMarketChartData>> GetChartDataAsync(CurrencyPair currencyPair, MarketPeriod period, DateTime startTime, DateTime endTime)
{
return Task.Factory.StartNew(() => GetChartData(currencyPair, period, startTime, endTime));
Expand Down
2 changes: 1 addition & 1 deletion PoloniexApi.Net/PoloniexClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public PoloniexClient(string publicApiKey, string privateApiKey)
}

/// <summary>Creates a new, unauthorized instance of Poloniex API .NET's client service.</summary>
public PoloniexClient() : this(null, null)
public PoloniexClient() : this("", "")
{

}
Expand Down
4 changes: 2 additions & 2 deletions PoloniexApi.Net/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.4")]
[assembly: AssemblyFileVersion("1.1.4")]
[assembly: AssemblyVersion("1.2.0")]
[assembly: AssemblyFileVersion("1.2.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
4 changes: 4 additions & 0 deletions PoloniexApi.Net/TradingTools/Trading.Interface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public interface ITrading

/// <summary>Fetches the trades made in your account, ordered by most recent first.</summary>
/// <param name="currencyPair">The currency pair, which consists of the currency being traded on the market, and the base's code.</param>
Task<IList<ITrade>> GetTradesAsync(CurrencyPair currencyPair);

/// <summary>Fetches the trades made in your account in a given time period, ordered by most recent first.</summary>
/// <param name="currencyPair">The currency pair, which consists of the currency being traded on the market, and the base's code.</param>
/// <param name="startTime">The time to start fetching data from.</param>
/// <param name="endTime">The time to stop fetching data at.</param>
Task<IList<ITrade>> GetTradesAsync(CurrencyPair currencyPair, DateTime startTime, DateTime endTime);
Expand Down

0 comments on commit da0871c

Please sign in to comment.