Exemplo n.º 1
0
        public static void RemoveCurrencyNonIncluded(UpdateDropDownList ddl, Kraken.Currency[] currency)
        {
            if (ddl == null || ddl.Items == null || ddl.Items.Count <= 0 || currency == null || currency.Length <= 0)
            {
                return;
            }

            var list = currency.ToList();

            for (int i = 0; i < ddl.Items.Count; i++)
            {
                var nvalue = Kraken.ToCurrency(ddl.Items[i].Value);
                if (nvalue == null || !nvalue.HasValue)
                {
                    continue;
                }

                var value = nvalue.Value;

                if (!currency.Contains(value))
                {
                    ddl.Items.RemoveAt(i);
                    RemoveCurrencyNonIncluded(ddl, currency);
                    return;
                }
            }
        }
        protected virtual void FinishEffect(Point3D p, Map map, Mobile from)
        {
            from.RevealingAction();

            int count = GetSpawnCount();

            for (int i = 0; map != null && i < count; ++i)
            {
                BaseCreature spawn;

                switch (Utility.Random(4))
                {
                default:
                case 0: spawn = new SeaSerpent(); break;

                case 1: spawn = new DeepSeaSerpent(); break;

                case 2: spawn = new WaterElemental(); break;

                case 3: spawn = new Kraken(); break;
                }

                Spawn(p, map, spawn);

                spawn.Combatant = from;
            }

            Delete();
        }
Exemplo n.º 3
0
        public void CalculateArbitrationTests_12()
        {
            ArbitrationHunter      hunter = new ArbitrationHunter(null);
            Kraken                 kraken = new Kraken();
            ArbitrationOpportunity opportunity;
            Bitstamp               bitstamp = new Bitstamp();
            OrderBook              askBook  = new OrderBook();
            OrderBook              bidBook  = new OrderBook();

            kraken.OrderBook   = askBook;
            bitstamp.OrderBook = bidBook;

            //Test case 12: Part of ask order is fulfilled, not profitable after taking into account transfer fee
            //IMPORTANT NOTE! This test assumes Kraken has a trade fee of 0.0005, if that changes, this test *MIGHT* fail!
            kraken.TradeFee   = 0.0m;
            bitstamp.TradeFee = 0.0m;

            askBook.Asks.Add(new Order(1.1m, 400.0m));
            askBook.Asks.Add(new Order(0.8m, 402.0m));
            askBook.Asks.Add(new Order(1.0m, 410.0m));

            bidBook.Bids.Add(new Order(0.6m, 400.25m));
            bidBook.Bids.Add(new Order(1.0m, 399m));
            bidBook.Bids.Add(new Order(2.8m, 398m));

            opportunity = hunter.CalculateArbitration(kraken, bitstamp, 99m, 999999m, 0.01m, true);

            //Make sure opportunity was not found, as it is not profitable when taking into account transfer fee
            Assert.IsTrue(opportunity == null);

            //Calculate arbitration again, but this time, don't take into account the transfer fee. An opportunity should be found this time.
            opportunity = hunter.CalculateArbitration(kraken, bitstamp, 99m, 999999m, 0.01m, false);
            Assert.IsTrue(opportunity != null);
        }
Exemplo n.º 4
0
        public void KrakenGetOpenOrdersTest()
        {
            Kraken kraken = new Kraken();

            //If there is any problem connecting to the exchange, this will throw an error.
            List <Dictionary <string, dynamic> > openOrderList = kraken.GetAllOpenOrders();
        }
Exemplo n.º 5
0
        public void KrakenAccountInformationUpdateTest()
        {
            Kraken kraken = new Kraken();

            //If there is any problem connecting to the exchange, this will throw an error.
            kraken.UpdateBalances();
        }
Exemplo n.º 6
0
        public void KrakenQueryOrderTest()
        {
            Kraken kraken = new Kraken();

            //If there is a problem,  this will throw an error.
            kraken.GetOrderInformation("O6HJVS-6SU7A-EX5TVD");
        }
Exemplo n.º 7
0
        public void KrakenMinimumBuyTest_Price()
        {
            Kraken kraken = new Kraken();

            //Amount doesn't do anything in this situation; just picked the minimum amount to be safe
            kraken.Buy(kraken.MinimumBitcoinOrderAmount, -1m);
        }
Exemplo n.º 8
0
        private static async Task MainAsync(string[] args)
        {
            Kraken kraken = new Kraken(krakenKey, krakenSecret, 2500);
            var    time   = await kraken.GetServerTimeAsync();

            //var assets = await kraken.GetAssetInfoAsync();
            //var assets = await kraken.GetAssetPairsAsync();
            //var ticker = await kraken.GetTickerAsync("XXBTZEUR");
            //var ohlc = await kraken.GetOHLCAsync("XXBTZEUR", 1440);
            //var orderbook = await kraken.GetOrderBookAsync("XXBTZEUR");
            //var trades = await kraken.GetRecentTradesAsync("XXBTZEUR");
            //var spread = await kraken.GetRecentSpreadAsync("XXBTZEUR");
            //var accountBalance = await kraken.GetAccountBalanceAsync();
            //var tradeBalance = await kraken.GetTradeBalanceAsync();
            //var openOrders = await kraken.GetOpenOrdersAsync();
            //var closedOrders = await kraken.GetClosedOrdersAsync();
            //var orders = await kraken.QueryOrdersAsync(new string[] { "x" });
            //var trades = await kraken.GetTradesHistoryAsync();
            //var openPositions = await kraken.GetOpenPositionsAsync(new string[] { "x" });
            //var ledgers = await kraken.GetLedgersAsync();
            //var volume = await kraken.GetTradeVolumeAsync(new string[] { "XXBTZEUR", "XXBTZUSD" }, true);

            //var order = new KrakenOrder();
            //order.Pair = "XXBTZEUR";
            //order.Type = "buy";
            //order.OrderType = "market";
            //order.Volume = 0.01m;
            //order.Validate = true;
            //var result = await kraken.AddOrderAsync(order);

            //var depositMethods = await kraken.GetDepositMethodsAsync(asset: "ZEUR");
            //var depositStatus = await kraken.GetDepositStatusAsync("ZEUR", "Fidor Bank AG (SEPA)");
        }
Exemplo n.º 9
0
            public override void Create()
            {
                Name = "Island";

                var water1 = new Water();
                var water2 = new Water();
                var water3 = new Water();
                var earth  = new Earth();

                Elements = new Element[]
                {
                    water1, water2, water3, earth
                };

                foreach (var element in Elements)
                {
                    element.Create();
                }

                var kraken    = new Kraken();
                var leviathan = new Leviathan();
                var merfolk1  = new Merfolk();
                var merfolk2  = new Merfolk();
                var merfolk3  = new Merfolk();

                Creatures = new Creature[]
                {
                    kraken, leviathan, merfolk1, merfolk2, merfolk3
                };

                foreach (var creature in Creatures)
                {
                    creature.Create();
                }
            }
Exemplo n.º 10
0
        public void GetTotalBalances()
        {
            ItBit    itbit    = new ItBit();
            Anx      anx      = new Anx();
            Bitstamp bitstamp = new Bitstamp();
            Kraken   kraken   = new Kraken();
            //Btce btce = new Btce();
            Bitfinex bitfinex = new Bitfinex();

            itbit.UpdateBalances();
            anx.UpdateBalances();
            bitstamp.UpdateBalances();
            bitfinex.UpdateBalances();

            //TODO: Fix these! Should be calls to UpdateTotalBalances!
            kraken.UpdateBalances();
            //btce.UpdateBalances();

            Decimal itBitBtcAmount      = itbit.TotalBtc;
            Decimal itBitFiatAmount     = itbit.TotalFiat;
            Decimal anxBtcAmount        = anx.TotalBtc;
            Decimal anxFiatAmount       = anx.TotalFiat;
            Decimal bitstampBtcAmount   = bitstamp.TotalBtc;
            Decimal bitstampFiatoAmount = bitstamp.TotalFiat;
            Decimal bitfinexBtcAmount   = bitfinex.TotalBtc;
            Decimal bitfinexFiatAmount  = bitfinex.TotalFiat;

            //TODO Fix these! They should be the total amounts!
            Decimal krakenBtcAmount = kraken.AvailableBtc;
            Decimal krakenEurAmount = kraken.AvailableFiat;
            //Decimal btceBtcAmount = btce.AvailableBtc;
            //Decimal btceEuroAmount = btce.AvailableFiat;
        }
Exemplo n.º 11
0
        public void KrakenMinimumBuyTest_Amount()
        {
            Kraken kraken = new Kraken();

            //Price doesn't do anything in this situation; just picked an absurdely low price to buy at
            kraken.Buy(kraken.MinimumBitcoinOrderAmount - 1, 1m);
        }
Exemplo n.º 12
0
 public void Setup()
 {
     _waterSpell   = new WaterSpell(CardType.Spell, ElementType.Water, 20, "Nasser Spell", 0, 1);
     _kraken       = new Kraken(CardType.Monster, ElementType.Water, 170, "Krakie dakie do whatcha gonna do", CardProperty.Kraken, 1);
     _goblinFire   = new Goblin(CardType.Monster, ElementType.Fire, 100, "Gobster the Robster", CardProperty.Goblin, 1);
     _goblinNormal = new Goblin(CardType.Monster, ElementType.Normal, 100, "Gobster the Robster", CardProperty.Goblin, 1);
 }
Exemplo n.º 13
0
        public void CalculateArbitrationTests_23()
        {
            ArbitrationHunter      hunter = new ArbitrationHunter(null);
            Kraken                 kraken = new Kraken();
            ArbitrationOpportunity opportunity;
            Anx       anx     = new Anx();
            OrderBook askBook = new OrderBook();
            OrderBook bidBook = new OrderBook();

            kraken.OrderBook = askBook;
            anx.OrderBook    = bidBook;

            kraken.TradeFee = 0.25m;
            anx.TradeFee    = 0.35m;

            askBook.Asks.Add(new Order(1.0m, 405.0m));

            bidBook.Bids.Add(new Order(0.78m, 410.0m));

            opportunity = hunter.CalculateArbitration(kraken, anx, 0.09m, 30.01m, 0.01m, false);

            //Make sure opportunity was found correctly
            Assert.IsTrue(opportunity != null);
            Assert.IsTrue(opportunity.BuyExchange == kraken);
            Assert.IsTrue(opportunity.SellExchange == anx);
            Assert.IsTrue(opportunity.BuyPrice == 405m);
            Assert.IsTrue(opportunity.SellPrice == 410m);
            Assert.IsTrue(opportunity.BuyAmount == 0.07391398m);
            Assert.IsTrue(opportunity.SellAmount == 0.07391398m);
            Assert.IsTrue(opportunity.TotalSellCost == 30.1986652387m);

            //Note, because Kraken rounds to 4 decimal places, the total buy cost and profit will be different that what is calculated on the sheet
            Assert.IsTrue(opportunity.TotalBuyCost == 30.01m);
            Assert.IsTrue(opportunity.Profit == 0.1886652387m);
        }
Exemplo n.º 14
0
 public void btnCompress_Click(object sender, EventArgs e)
 {
     try
     {
         if (CurrentNodeId > 0)
         {
             var result = Kraken.Compress(CurrentNodeId);
             if (result != null && result.success)
             {
                 // Opslaan in Umbraco
                 result.Save();
                 // Umbraco Media tree verversen
                 Helper.refreshMediaSection(CurrentNodeId);
             }
         }
     }
     catch (KrakenException kex)
     {
         var ct = new umbraco.BasePages.ClientTools(Page);
         ct.ShowSpeechBubble(umbraco.BasePages.BasePage.speechBubbleIcon.error, "Optimization error", Helper.GetEnumDescription(kex.Status));
     }
     catch (Exception kex)
     {
         var ct = new umbraco.BasePages.ClientTools(Page);
         ct.ShowSpeechBubble(umbraco.BasePages.BasePage.speechBubbleIcon.error, "Unexpected internal error", "Image could not optimized");
     }
 }
Exemplo n.º 15
0
        public void createAllMonstercards()
        {
            ICard card1 = new Dragon(100);
            ICard card2 = new FireElf(60);
            ICard card3 = new WaterGoblin(40);
            ICard card4 = new Knight(80);
            ICard card5 = new Kraken(80);
            ICard card6 = new Ork(70);
            ICard card7 = new Wizard(90);

            Cardname desiredName1 = Cardname.Dragon;
            Cardname desiredName2 = Cardname.FireElf;
            Cardname desiredName3 = Cardname.WaterGoblin;
            Cardname desiredName4 = Cardname.Knight;
            Cardname desiredName5 = Cardname.Kraken;
            Cardname desiredName6 = Cardname.Ork;
            Cardname desiredName7 = Cardname.Wizard;

            Assert.AreEqual(desiredName1, card1.name);
            Assert.AreEqual(desiredName2, card2.name);
            Assert.AreEqual(desiredName3, card3.name);
            Assert.AreEqual(desiredName4, card4.name);
            Assert.AreEqual(desiredName5, card5.name);
            Assert.AreEqual(desiredName6, card6.name);
            Assert.AreEqual(desiredName7, card7.name);
        }
        public void DecodeStepThrows(byte[] rawData, string message)
        {
            var kraken    = new Kraken();
            var exception = Assert.Throws <DecoderException>(() => kraken.Decompress(rawData, 393294));

            Assert.Equal(message, exception.Message);
        }
Exemplo n.º 17
0
        public void KrakenMinimumSellTest_Amount()
        {
            Kraken kraken = new Kraken();

            //Price doesn't do anything in this situation; just picked an absurdely high price to sell at
            kraken.Sell(kraken.MinimumBitcoinOrderAmount - 1, 99999m);
        }
Exemplo n.º 18
0
 public KrakenAttackState(Boss boss) : base(StateIds.Attacking, boss)
 {
     NextStateIds.Add(StateIds.Idle);
     NextStateIds.Add(StateIds.Stunned);
     NextStateIds.Add(StateIds.Hurt);
     random = new System.Random();
     kraken = boss as Kraken;
 }
Exemplo n.º 19
0
 public override void TStart()
 {
     base.TStart();
     kraken        = this.transform.parent.GetComponent <Kraken>();
     prefab        = Resources.Load("Prefabs/Enemies/Kraken") as GameObject;
     tentacleAtk   = GetComponent <TentacleAttack>();
     initialHealth = stats.health;
 }
Exemplo n.º 20
0
        public Client(Kraken exchange, ICurrencyFactory currencyFactory, ISymbolFactory symbolFactory)
        {
            Exchange        = exchange;
            CurrencyFactory = currencyFactory;
            SymbolFactory   = symbolFactory;

            RateLimiter = new BinanceRateLimiter();
        }
Exemplo n.º 21
0
        public void Constructor_WithParameters_ReturnsTrue()
        {
            //Arrange
            Kraken leviathan = new Kraken("KRAKEN", 800, element.WATER, 100);

            //Assert
            Assert.AreEqual(leviathan.Name, "KRAKEN");
        }
Exemplo n.º 22
0
        public void KrakenMinimumTransferTest()
        {
            Kraken kraken = new Kraken();

            //Give less than the minimum amount to ensure we can an error
            //Address isn't needed here, just give a random string
            kraken.Transfer(kraken.MinimumBitcoinWithdrawalAmount - 1, "fakeAddress");
        }
Exemplo n.º 23
0
        public void Constructor_Base_ReturnsTrue()
        {
            //Arrange
            Kraken leviathan = new Kraken();

            // Assert
            Assert.IsTrue(leviathan.Name == "Leviathan");
        }
Exemplo n.º 24
0
 public void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         // Begin de installatie!
         Kraken.Install();
     }
 }
Exemplo n.º 25
0
        private void FinishEffect(Point3D p)
        {
            int count = Utility.RandomMinMax(5, 7);

            if (Hue != 0x8A0)
            {
                count += Utility.RandomMinMax(1, 2);
            }

            Map map = this.Map;

            Leviathan lev = new Leviathan();

            lev.MoveToWorld(p, map);

            for (int i = 0; map != null && i < count; ++i)
            {
                BaseCreature spawn;

                switch (Utility.Random(4))
                {
                default:
                case 0: spawn = new SeaSerpent(); break;

                case 1: spawn = new DeepSeaSerpent(); break;

                case 2: spawn = new WaterElemental(); break;

                case 3: spawn = new Kraken(); break;
                }

                int x = p.X, y = p.Y;

                for (int j = 0; j < 20; ++j)
                {
                    int tx = p.X - 5 + Utility.Random(11);
                    int ty = p.Y - 5 + Utility.Random(11);

                    Tile t = map.Tiles.GetLandTile(tx, ty);

                    if (t.Z == p.Z && ((t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137)) && !Spells.SpellHelper.CheckMulti(new Point3D(tx, ty, p.Z), map))
                    {
                        x = tx;
                        y = ty;
                        break;
                    }
                }

                spawn.MoveToWorld(new Point3D(x, y, p.Z), map);

                if (spawn is Kraken && 0.2 > Utility.RandomDouble())
                {
                    spawn.PackItem(new MessageInABottle(map == Map.Felucca ? Map.Felucca : Map.Trammel));
                }
            }

            Delete();
        }
Exemplo n.º 26
0
        public void KrakenUpdateTradeFeeTest()
        {
            Kraken kraken = new Kraken();

            //If there is any problem connecting to the exchange, this will throw an error.
            kraken.SetTradeFee();

            Assert.IsTrue(kraken.TradeFee > 0);
        }
Exemplo n.º 27
0
    void Start()
    {
        checkpointTitles.Add("Arrival to the Floe");
        checkpointTitles.Add("Ice Corridors");
        checkpointTitles.Add(string.Empty);
        checkpointTitles.Add("The Kraken");

        krakenScript = FindObjectOfType <Kraken> ();
    }
Exemplo n.º 28
0
 public KrakenAttackState(Boss boss)
     : base(StateIds.Attacking, boss)
 {
     NextStateIds.Add(StateIds.Idle);
     NextStateIds.Add(StateIds.Stunned);
     NextStateIds.Add (StateIds.Hurt);
     random = new System.Random();
     kraken = boss as Kraken;
 }
Exemplo n.º 29
0
 public void Start()
 {
     kraken = gameObject.GetComponentInParent <Kraken>() as Kraken;
     if (closedEyeRenderer == null)
     {
         closedEyeRenderer = GetComponent <MeshRenderer>() as MeshRenderer;
     }
     closedEyeRenderer.enabled = false;
 }
Exemplo n.º 30
0
    void Start()
    {
        checkpointTitles.Add ("Arrival to the Floe");
        checkpointTitles.Add ("Ice Corridors");
        checkpointTitles.Add (string.Empty);
        checkpointTitles.Add ("The Kraken");

        krakenScript = FindObjectOfType<Kraken> ();
    }
Exemplo n.º 31
0
        public void KrakenAccountInformationUpdateTest()
        {
            Kraken kraken = new Kraken();

            //If there is any problem connecting to the exchange, this will throw an error.
            kraken.UpdateAccountInformation();

            //Only need to ensure UpdateAccountInformation updates trade fee, as btc and fiat balances are allowed to be zero.
            Assert.IsTrue(kraken.TradeFee > 0.0m);
        }
Exemplo n.º 32
0
        public void HasPreyInterFaceProperties()
        {
            //arrange
            Kraken WeakKraken = new Kraken();
            //act
            string input = "Oh no!";

            //assert
            Assert.Equal(input, WeakKraken.TheFirstFiveSeconds(input));
        }
Exemplo n.º 33
0
 void Awake()
 {
     HealthPoints = maxHealthPoints;
     tentaculeAnim = gameObject.GetComponent<Animator>() as Animator;
     kraken = gameObject.GetComponentInParent<Kraken>() as Kraken;
     harpoonImpact = GetComponent<AudioSource>();
     Dead = false;
     waterLevel = WaterLevel.Instance;
     material = gameObject.GetComponentInChildren<SkinnedMeshRenderer>().material;
     initialColor = material.color;
     rangeDetector = GetComponent<SphereCollider>() as SphereCollider;
     animationSpeedMod = ((float)Utils.Instance.Rng.NextDouble() - 0.5f)*0.75f + 1f;
     tentaculeAnim.speed = animationSpeedMod;
 }
Exemplo n.º 34
0
 public void Start()
 {
     kraken = gameObject.GetComponentInParent<Kraken>() as Kraken;
     if(closedEyeRenderer == null) closedEyeRenderer = GetComponent<MeshRenderer>() as MeshRenderer;
     closedEyeRenderer.enabled = false;
 }
Exemplo n.º 35
0
 void Awake()
 {
     kraken = GameObject.FindGameObjectWithTag (Tags.kraken).GetComponent<Kraken> ();
 }