Skip to content

Commit 46f355c

Browse files
authored
Create exchange API by name (#695)
1 parent b48467b commit 46f355c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,18 @@ public static async Task<T> CreateExchangeAPIAsync<T>() where T : ExchangeAPI
405405
return (T)await InitializeAPIAsync(typeof(T));
406406
}
407407

408+
/// <summary>
409+
/// Create an exchange api, by-passing any cache. Use this method for cases
410+
/// where you need multiple instances of the same exchange, for example
411+
/// multiple credentials.
412+
/// </summary>
413+
/// <returns>Created exchange api</returns>
414+
public static async Task<IExchangeAPI> CreateExchangeAPIAsync(string name)
415+
{
416+
var type = ExchangeName.GetExchangeType(name);
417+
return await InitializeAPIAsync(type);
418+
}
419+
408420
/// <summary>
409421
/// Get a cached exchange API given an exchange name (see ExchangeName class)
410422
/// </summary>

0 commit comments

Comments
 (0)