The resource loading... loading...

The inventor's quantum chemistry diary (three) (updated...)

Author: Inventors quantify - small dreams, Created: 2017-06-03 09:29:22, Updated: 2019-07-31 18:33:16

  • Question one:

    Some discoveries when using the _N function (API documentation Location shown below)

    img

    img

    _N is used to handle floating-point numbers.

    Let's start with a code example:

    function main(){
        var pi = 3.1415926535897;    // 声明一个变量 储存 圆周率, 小数位数13位。
        Log(_N(pi, 4) * 100);        // 当我们使用 _N 函数 保留4位小数后 再 乘以 100 会是什么结果呢?
    }
    

    What happens when we use the _N function to keep the four decimal places and then multiply by 100?

    I started by thinking that N (pi, 4) returns 3.1415, and then times 100 is equal to 314.15.

    The actual results:

    img

    I'm pretty clear on why I'm using N, and why there's so many smaller numbers.

    If you want to display 314.15, you can simply write:

    function main(){
        var pi = 3.1415926535897;
        Log(_N(pi * 100, 2));
    }
    

    img

    Alternatively, an error may occur if the first parameter _N is passed to a string value:

    The test code is:

    function main(){
        var pi = "3.1415";     // 传入 字符串 3.1415 , 很多时候解析出来的数据没有检查类型,可能会误传入字符串。
        _N(pi, 2);
    }
    

    I really stepped in the hole, the data was a string, and then I saw the following error message.

    img

    DEBUG took a while to figure out why, so you can get more out of it.


  • Issue 2: Safari Browser Below, bot Running page Log output logs Displaying the issue

    In the Safari browser, when the bot is running a page, if there is too much content in a single Log output, it can cause the entire Log information to be hidden and shown as a blank.

  • Issue 3: Status bar refresh issue

    The status bar refreshes, i.e. every time the API function LogStatus is called, the function refreshes the display of the contents, if the current log page is not on the first page, the query mechanism is triggered, at which point the status bar of the bot page will no longer be updated. When the log page is selected as the first page, the status bar is restored.

  • Question 4: When I was in elementary school, I directly copied the code I was interested in into my strategy, and found that both the retest and the real disk returned errors.

    For example, this user reported an error message:

    This is the real thing.

    img

    This is not the first time.

    img

    Both of these errors are caused by using undefined variables.

    The reason:

    The reason is to copy the code directly into the policy, and some of the policies are very simple.ParametersIt's in the strategy.Interface parametersI'm not sure what to do. Set a parameter on the policy interfaceParametric variablesThis is equivalent to declaring a strategy in code.Global variablesIf it's just copying code. The variables (parameters) of the ** policy interface that may be used in the code are in the undefined state. So it's a mistake, if you want to test someone else's strategy, it's best to copy the whole strategy.

    For example, the copy page for this policy (click on the policy square to access the policy of the open type):

    Click on the button, click on the copy button, click on the copy button, click on the copy button, click on the copy button, click on the copy button, click on the copy button, click on the copy button, click on the copy button, click on the copy button, click on the copy button.

    img img

  • Problem 5: AEX exchange API error: GetOrders: type assertion to []interface{} failed.

    This type of error may be caused by not setting the Host IP address to the Exchange API KEY IP address whitelist. Adding IP addresses to the whitelist can solve this problem.

  • Question 6: Little knowledge of the market for hedge funds and floating funds

    Futures floating profit or loss, also known as a single-penny float, for example, you buy 2480 1 hand screw steel, no matter how many trading days you have, the current price is 2520, the floating profit or loss is 400 yuan, the floating profit or loss indicates the current holding of your position relative to the opening price; Futures floating profit or loss, also called floating market, for example, you hold 1 hand screw steel orders, the settlement price of the last trading day is 2500, the price is 2520, the yuan market loss is 200 previously, the floating market loss represents the loss of your current position relative to the settlement price of the previous trading day.

  • Question number seven:

    The sum of the numeric and undefined variables returns Nan, and the sum of the objects and undefined objects returns undefined.

    function main(){
        var a = 11// {aa : "aa", bb : 12}
        var b = {}
        Log(a + b.c)
    
    }
    
  • Question 8: What is the problem?

    Weird Error: TypeError: cannot read property Sleep of undefined at main (FILE:103)

      var id2 = e.Sell(ticker.Sell + ticker.Sell * 0.05, 0.1)
    
      var order2 = e.GetOrder(id2)
      Log("order2:", order).
    
      Sleep(2000)               # 103 行, 这里报错。
    

    After looking for half a day, he couldn't figure it out. I finally read it carefully and found Log (order2:, order). So here's a recording of the scene where if you have such a bizarre question, think of this scenario.

  • 9 - Both the bot and the host are showing normal, but the actual bot is not working and there are no updates to the logs, what is the situation?

It's like a setup, no logs, and no way to restart.

Reason: Old DB3 files have reached 25G It's a big deal, but it's not a big deal.

>_< When encountering such problems, please check the host's location, computer or server, hard disk and system status.

In a continuous update...


More

Aaron muskThank you!