1111 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 * See the License for the specific language governing permissions and
1313 * limitations under the License.
14- */
14+ */
1515
1616using Moq ;
1717using NUnit . Framework ;
2020using QuantConnect . Orders ;
2121using QuantConnect . Tests . Brokerages ;
2222using System ;
23+ using System . Collections . Generic ;
2324using QuantConnect . Orders . Fees ;
2425using QuantConnect . Securities ;
2526using QuantConnect . Securities . CryptoFuture ;
@@ -40,18 +41,35 @@ public class BybitBrokerageModelTests
4041 [ SetUp ]
4142 public void Init ( )
4243 {
43- _crypto = TestsHelpers . GetSecurity ( symbol : BTCUSDT . Value ,
44- securityType : BTCUSDT . SecurityType ,
45- market : BTCUSDT . ID . Market ,
46- quoteCurrency : "USDT" ) ;
47- _cryptoFuture = TestsHelpers . GetSecurity ( symbol : BTCUSDT_Future . Value ,
48- securityType : BTCUSDT_Future . SecurityType ,
49- market : BTCUSDT_Future . ID . Market ,
44+ _crypto = GetSecurity ( BTCUSDT ) ;
45+ _cryptoFuture = GetSecurity ( BTCUSDT_Future ) ;
46+ }
47+
48+ private static Security GetSecurity ( Symbol symbol )
49+ {
50+ return TestsHelpers . GetSecurity ( symbol : symbol . Value ,
51+ securityType : symbol . SecurityType ,
52+ market : symbol . ID . Market ,
5053 quoteCurrency : "USDT" ) ;
5154 }
5255
53- [ TestCase ( 0.01 , true ) ]
54- [ TestCase ( 0.000001 , false ) ]
56+ private static decimal GetMinOrderSize ( Symbol symbol )
57+ {
58+ var crypto = GetSecurity ( symbol ) ;
59+ return crypto . SymbolProperties . MinimumOrderSize ?? 0 ;
60+ }
61+
62+ private static IEnumerable < TestCaseData > MarketOrderSizeTestCases
63+ {
64+ get
65+ {
66+ yield return new TestCaseData ( 0.01m , true ) ;
67+ yield return new TestCaseData ( 0.000001m , false ) ;
68+ yield return new TestCaseData ( GetMinOrderSize ( BTCUSDT ) , true ) ;
69+ }
70+ }
71+
72+ [ TestCaseSource ( nameof ( MarketOrderSizeTestCases ) ) ]
5573 public void CanSubmitMarketOrder_OrderSizeIsLargeEnough ( decimal orderQuantity , bool isValidOrderQuantity )
5674 {
5775 var order = new Mock < MarketOrder > ( ) ;
@@ -76,8 +94,17 @@ public void CanSubmitMarketOrder_OrderSizeIsLargeEnough(decimal orderQuantity, b
7694 }
7795 }
7896
79- [ TestCase ( 0.01 , 4500 , true ) ]
80- [ TestCase ( 0.000001 , 4500 , false ) ]
97+ private static IEnumerable < TestCaseData > LimitOrderSizeTestCases
98+ {
99+ get
100+ {
101+ yield return new TestCaseData ( 0.01m , 4500m , true ) ;
102+ yield return new TestCaseData ( 0.000001m , 4500m , false ) ;
103+ yield return new TestCaseData ( GetMinOrderSize ( BTCUSDT ) , 4500m , true ) ;
104+ }
105+ }
106+
107+ [ TestCaseSource ( nameof ( LimitOrderSizeTestCases ) ) ]
81108 public void CanSubmitLimitOrder_OrderSizeIsLargeEnough ( decimal orderQuantity , decimal limitPrice , bool isValidOrderQuantity )
82109 {
83110 var order = new Mock < LimitOrder >
0 commit comments