public void OnlyAssetsThatEnabledAreAvailableInFixTest()
            {
                var assetPairs  = privateApi.Assets.GetAssetPairs().GetResponseObject().FindAll(a => a.IsDisabled == false);
                var validAssets = privateApi.Assets.GetAssets(false).GetResponseObject().
                                  FindAll(a => a.IsDisabled == false).FindAll(a => a.IsTradable == true);

                assetPairs = assetPairs.FindAll(a =>
                                                a.IsDisabled == false
                                                ).FindAll(a =>
                                                          validAssets.Any(va => va.Id == a.BaseAssetId)
                                                          ).FindAll(a =>
                                                                    validAssets.Any(va => va.Id == a.QuotingAssetId)
                                                                    );

                fixClient = new FixClient("LYKKE_T", "SENDER_T", Init.LocalConfig()["TestClient"]["ServiceUrl"].ToString(), 12357);
                fixClient.Init();

                Assert.Multiple(() =>
                                assetPairs.ToList().ForEach(a =>
                {
                    if (!a.Id.EndsWith("cy"))
                    {
                        CreateLimitOrderWithAssetPair(a.Id, (decimal)a.MinVolume);
                    }
                })
                                );
            }
Ejemplo n.º 2
0
 public static List <EntityProperty> GetValueFromAzure(string message)
 {
     return(new AzureUtils(Init.LocalConfig()["AzureConnectionString"].ToString())
            .GetCloudTable("FixGatewayMessagesLog")
            .GetSearchResult("Message", message)
            .GetCellsByKnownCellName("Message"));
 }
Ejemplo n.º 3
0
            public void WrongCredentialsTest()
            {
                Environment.SetEnvironmentVariable("FIXWrongPassword", TestData.GenerateString(6));

                var fixClient2 = new FixClient("LYKKE_T", "SENDER_T", Init.LocalConfig()["TestClient"]["ServiceUrl"].ToString(), 12357);

                fixClient2.Init();

                var orderId     = Guid.NewGuid().ToString();
                var price       = 0.01m;
                var quantity    = 0.01m;
                var marketOrder = FixHelpers.CreateNewOrder(orderId, isMarket: false, isBuy: true, qty: quantity, price: price);

                try
                {
                    fixClient2.Send(marketOrder);
                    Assert.Fail("First instance on FIXClient has not been disconnected after second has been created");
                }
                catch (Exception)
                {
                    fixClient2.GetResponse <Message>();
                }
                finally
                {
                    Environment.SetEnvironmentVariable("FIXWrongPassword", null);
                }
            }
            public void LimitOrderPriceLessThenMinAssetPriceTest()
            {
                Environment.SetEnvironmentVariable("WalletApiUrl", "https://api-dev.lykkex.net/api");

                var assetPairs  = privateApi.Assets.GetAssetPairs().GetResponseObject().FindAll(a => a.IsDisabled == false);
                var validAssets = privateApi.Assets.GetAssets(false).GetResponseObject().
                                  FindAll(a => a.IsDisabled == false).FindAll(a => a.IsTradable == true);

                assetPairs = assetPairs.FindAll(a =>
                                                a.IsDisabled == false
                                                ).FindAll(a =>
                                                          validAssets.Any(va => va.Id == a.BaseAssetId)
                                                          ).FindAll(a =>
                                                                    validAssets.Any(va => va.Id == a.QuotingAssetId)
                                                                    );

                var assetPair = assetPairs.Find(a => a.MinVolume > 0);

                var orderId = Guid.NewGuid().ToString();

                var marketOrder = FixHelpers.CreateNewOrder(orderId, isMarket: false, isBuy: false, qty: (decimal)(assetPair.MinVolume), price: (decimal)(assetPair.MinVolume / (2 * Math.Pow(10, assetPair.Accuracy))), assetPairId: assetPair.Id);

                fixClient.Send(marketOrder);

                var response = fixClient.GetResponse <Message>();

                Assert.That(response, Is.Not.Null, $"unexpected response: {response.ToString().Replace("\u0001", "|")}");
                Assert.That(response, Is.TypeOf <ExecutionReport>(), $"unexpected response type response: {response.ToString().Replace("\u0001", "|")}");

                var ex = (ExecutionReport)response;
                // Assert.That(ex.OrdStatus.Obj, Is.EqualTo(OrdStatus.REJECTED));
                // Assert.That(ex.ExecType.Obj, Is.EqualTo(ExecType.REJECTED));


                AuthenticateModel auth = new AuthenticateModel()
                {
                    ClientInfo = "<android>;Model:<LENOVO S860>;Os:<android>;Screen:<720x1184>",
                    Email      = Init.LocalConfig()["User"].ToString(),
                    Password   = Init.LocalConfig()["Pass"].ToString()
                };
                var authResponse = walletApi.Auth.PostAuthResponse(auth);
                var obook        = walletApi.LimitOrders.GetOffchainLimitList(authResponse.GetResponseObject().Result.Token, assetPair.Id).GetResponseObject().Result.Orders.ToList().Find(o => o.Id == ex.OrderID.ToString());
            }
 public void SetUp()
 {
     fixClient = new FixClient("LYKKE_T", "SENDER_T", Init.LocalConfig()["TestClient"]["ServiceUrl"].ToString(), 12357);
     fixClient.Init();
 }
Ejemplo n.º 6
0
 public void SetUp()
 {
     fixClient = new FixClient(uri: Init.LocalConfig()["TestClient"]["ServiceUrl"].ToString());
     fixClient.Init();
 }