Skip to content

Commit

Permalink
Updated return type of BybitEnvironment.CreateCustom, added Demo trad…
Browse files Browse the repository at this point in the history
…ing environment
  • Loading branch information
JKorf committed Apr 19, 2024
1 parent 05fbf9e commit 08f537e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ByBit.Net/BybitEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,22 @@ internal BybitEnvironment(string name,
BybitApiAddresses.HongKong.RestBaseAddress,
BybitApiAddresses.HongKong.SocketBaseAddress);

/// <summary>
/// Demo trading environment, needs seperate API key. See https://bybit-exchange.github.io/docs/v5/demo
/// </summary>
public static BybitEnvironment DemoTrading { get; }
= new BybitEnvironment(TradeEnvironmentNames.Live,
BybitApiAddresses.DemoTrading.RestBaseAddress,
BybitApiAddresses.DemoTrading.SocketBaseAddress);

/// <summary>
/// Create a custom environment
/// </summary>
/// <param name="name"></param>
/// <param name="restAddress"></param>
/// <param name="socketAddress"></param>
/// <returns></returns>
public static TradeEnvironment CreateCustom(
public static BybitEnvironment CreateCustom(
string name,
string restAddress,
string socketAddress)
Expand Down
9 changes: 9 additions & 0 deletions ByBit.Net/Objects/BybitApiAddresses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,14 @@ public class BybitApiAddresses
RestBaseAddress = "https://api.bybit.com.hk",
SocketBaseAddress = "wss://stream.bybit.com" // As per Telegram support, normal address should be used for websockets
};

/// <summary>
/// The addresses to connect to the Bybit demo trading environment
/// </summary>
public static BybitApiAddresses DemoTrading = new BybitApiAddresses
{
RestBaseAddress = "https://api-demo.bybit.com",
SocketBaseAddress = "wss://stream-demo.bybit.com"
};
}
}

0 comments on commit 08f537e

Please sign in to comment.