fponticelli / thx.core

Super-charged standard library for Haxe.
http://thx-lib.org
MIT License
124 stars 43 forks source link

(WDeprecated) Std.is is deprecated. Use Std.isOfType instead. #285

Open colby8265 opened 11 months ago

colby8265 commented 11 months ago

I got follow error after compile my hx code to Java

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Weekday.hx:7: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Weekday.hx:7: characters 1-7 : Warning : (WDeprecatedEnumAbstract) `@:enum abstract` is deprecated in favor of `enum abstract`

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:142: characters 45-73 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:143: characters 12-31 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:289: characters 47-75 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:298: characters 22-50 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:301: characters 16-32 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:431: characters 13-37 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:441: characters 12-35 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:461: characters 12-34 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:470: characters 12-35 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Assert.hx:485: characters 13-96 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Dynamics.hx:35: characters 13-30 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Dynamics.hx:39: characters 13-29 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Dynamics.hx:51: characters 12-27 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Dynamics.hx:55: characters 13-26 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Dynamics.hx:255: characters 16-29 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Error.hx:18: characters 8-26 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Maps.hx:127: characters 12-27 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Objects.hx:50: characters 10-26 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Objects.hx:229: characters 22-39 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Types.hx:117: characters 8-37 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Types.hx:119: characters 8-28 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

/usr/local/lib/haxe/lib/thx,core/0,44,0/src/thx/Types.hx:121: characters 8-27 : Warning : (WDeprecated) Std.is is deprecated. Use Std.isOfType instead.

Stack overflow

My src code

import thx.Decimal;

class ContractMath {

    /***
     张数 = 数量/合约面值
    **/
    static function getPiecesByAmount(amount:Decimal, multifier:Decimal):Decimal {
        if (multifier <= 0) {
            return -1;
        }
        return amount/multifier;
    }
    /***
     数量(本位币) = 张数*合约面值
    **/
    static function getAmount(pieces:Int, multifier:Decimal):Decimal {
        return pieces*multifier;
    }

    /***
     委托价值(市价)= 委托张数*合约面值*标记价格
    **/
    static function getValueByMarkPrice(pieces:Int, multifier:Decimal, markPrice:Decimal):Decimal {
        return pieces*multifier*markPrice;
    }

    /***
     委托价值(限价)= 委托张数*合约面值*限价价格
    **/
    static function getValueByLimitPrice(pieces:Int, multifier:Decimal, limitPrice:Decimal):Decimal {
        return pieces*multifier*limitPrice;
    }

    /***
     委托张数(市价)= 委托价值/合约面值/标记价格
    **/
    static function getPiecesByMarkPrice(value:Decimal, mulitifier:Decimal, markPrice:Decimal):Decimal {
        if (mulitifier <= 0 || markPrice <= 0) {
            return -1;
        }
        return value/mulitifier/markPrice;
    }

    /***
     委托张数(限价)= 委托价值/合约面值/委托价格
    **/
    static function getPiecesByLimitPrice(value:Decimal, mulitifier:Decimal, limitPrice:Decimal):Decimal {
        if (mulitifier <= 0 || limitPrice <= 0) {
            return -1;
        }
        return value/mulitifier/limitPrice;
    }

    /***
     盈亏= (当前标记价格-持仓均价)*持仓币量
    **/
    static function getPNL(markPrice:Decimal, avgFilledPrice:Decimal, filledAmount:Decimal):Decimal {
        return (markPrice-avgFilledPrice)*filledAmount;
    }

    /***
     回报率= 盈亏/(持仓均价*持仓币量/杠杆倍数)
    **/
    static function getPNLRate(pnl:Decimal, avgFilledPrice:Decimal, filledAmount:Decimal, leverLevel:Int):Decimal {
        if (avgFilledPrice <= 0 || filledAmount <= 0 || leverLevel <= 0) {
            return -1;
        }
        return pnl/(avgFilledPrice*filledAmount/leverLevel);
    }

}

My compile cmd: haxe -lib thx.core Main.hx -java java

I have installed thx.core: [0.44.0] Who has ideas how to fix this problem?

fponticelli commented 2 months ago

The library is not regularly maintained and probably needs some adjustment like the one suggested by the compiler.