diff --git a/.webpackrc.js b/.webpackrc.js index 342ff5d..6b5066f 100644 --- a/.webpackrc.js +++ b/.webpackrc.js @@ -20,9 +20,20 @@ export default { hash: true, publicPath: '/', proxy: { - "/api/*": { + "/api/v1/User/*": { + target: 'http://192.168.70.131:5001', + // target: 'http://192.168.70.131:5003', + changeOrigin: true + }, + "/api/v1/gateway/*": { + // target: 'http://192.168.70.131:5001', target: 'http://192.168.70.131:5003', changeOrigin: true + }, + "/api/v1/country/*": { + // target: 'http://192.168.70.131:5001', + target: 'http://192.168.70.131:5001', + changeOrigin: true } }, alias: { diff --git a/README.md b/README.md index 0736f5d..ae33960 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,16 @@ -# Develop分支上是最新的代码,master分支不定期更新,本项目所有的接口都有mock服务, +# Develop分支上是最新的代码,master分支不定期更新,本项目所有的接口都有mock服务。 ## 重要文件 tradeview文件 /src/routes/Home/TradeChart.js websocket文件 /services/SocketClient.js +## 预览 +![avatar](http://p09oq805j.bkt.clouddn.com/hopex_black.png) +![avatar](http://p09oq805j.bkt.clouddn.com/hopex_white.png) + +## 开启mock服务 +本项目本地开启mock服务,需要把hopex/src/services/trade.js第5行MODE='mock1'改为MODE='mock'即可 + ## host配置 127.0.0.1 hopex.com 127.0.0.1 localhost @@ -86,6 +93,5 @@ websocket文件 /services/SocketClient.js } ``` -## 预览 -![avatar](http://p09oq805j.bkt.clouddn.com/hopex.png) + diff --git a/mock/index.js b/mock/index.js index 531cc86..e75a239 100644 --- a/mock/index.js +++ b/mock/index.js @@ -11,42 +11,64 @@ const other = { "ret": "0" } +const users_vertify = { + "idCard": { + "realName": "", + "idCardNo": "", + "name": "实名认证", + "code": "IdCard", + "verified": false + }, + "bank": { + "idCardVerified": false, + "owner": "", + "bankNo": "", + "bankName": "", + "name": "银行卡", + "code": "Bank", + "verified": false + } +} + + export default delay({ // 合约列表 - 'Post /mock/api/v1/quote/market.detail_list': (req, res) => { + 'Get /mock/api/v1/gateway/Home/Contracts': (req, res) => { res.send({ "data": [{ "name": "BTC", "list": [{ - "price24h": "6600.00", - "priceLast": "6600.0", - "direction": -1, - "marketCode": "BTCUSDT", - "marketName": "BTCUSDT永续", + minPriceMovementPrecision: 6, + "priceLast": "+6700.0", + "direction": 0, + "contractCode": "BTCUSDT", + "contractName": "BTCUSDT永续", "percent": "0.00%", - "dollarPrice": "$6600.00", + "dollarPrice": "$6700.00", "totalPrice24h": "0BTC", - "position": false, + "position": true, "pause": false }] }, { "name": "ETH", "list": [{ - "marketCode": "ETHBTC", - "marketName": "ETHBTC永续", - "price24h": "", - "priceLast": "", + minPriceMovementPrecision: 2, + "priceLast": "0.0", + "direction": 0, + "contractCode": "ETHBTC", + "contractName": "ETHBTC永续", "percent": "", - "dollarPrice": "", + "dollarPrice": "$0.00", + "totalPrice24h": "", "position": false, "pause": true }, { - "price24h": "270.00000", - "priceLast": "270.0", - "direction": -1, - "marketCode": "ETHUSDT", - "marketName": "ETHUSDT永续", - "percent": "0.00%", + minPriceMovementPrecision: 2, + "priceLast": "+270.0", + "direction": 0, + "contractCode": "ETHUSDT", + "contractName": "ETHUSDT永续", + "percent": "-8.00%", "dollarPrice": "$270.00", "totalPrice24h": "0ETH", "position": false, @@ -55,109 +77,45 @@ export default delay({ }, { "name": "XRP", "list": [{ - "price24h": "0.00006780", - "priceLast": "0.0000678", - "direction": 1, - "marketCode": "XRPBTC", - "marketName": "XRPBTC永续", - "percent": "0.00%", - "dollarPrice": "$0.44", - "totalPrice24h": "0BTC", - "position": false, - "pause": false - }, { - "marketCode": "XRPETH", - "marketName": "XRPETH永续", - "price24h": "", - "priceLast": "", + minPriceMovementPrecision: 3, + "priceLast": "0", + "direction": 0, + "contractCode": "XRPUSDT", + "contractName": "XRPUSDT永续", "percent": "", - "dollarPrice": "", + "dollarPrice": "$0.00", + "totalPrice24h": "", "position": false, "pause": true }, { - "marketCode": "XRPUSDT", - "marketName": "XRPUSDT永续", - "price24h": "", - "priceLast": "", + minPriceMovementPrecision: 4, + "priceLast": "0", + "direction": 0, + "contractCode": "XRPETH", + "contractName": "XRPETH永续", "percent": "", - "dollarPrice": "", - "position": false, - "pause": false - }] - }, { - "name": "EOS", - "list": [{ - "price24h": "0.017500", - "priceLast": "0.01750", - "direction": 1, - "marketCode": "EOSETH", - "marketName": "EOSETH永续", - "percent": "0.00%", - "dollarPrice": "$7.89", - "totalPrice24h": "0ETH", - "position": false, - "pause": false - }, { - "price24h": "0.0007501", - "priceLast": "0.0007501", - "direction": 1, - "marketCode": "EOSBTC", - "marketName": "EOSBTC永续", - "percent": "0.00%", - "dollarPrice": "$5.02", - "totalPrice24h": "0BTC", + "dollarPrice": "$0.00", + "totalPrice24h": "", "position": false, "pause": true - }] - }, { - "name": "LTC", - "list": [{ - "price24h": "0.008580", - "priceLast": "0.00858", - "direction": 1, - "marketCode": "LTCBTC", - "marketName": "LTCBTC永续", + }, { + minPriceMovementPrecision: 5, + "priceLast": "+0.0000678", + "direction": 0, + "contractCode": "XRPBTC", + "contractName": "XRPBTC永续", "percent": "0.00%", - "dollarPrice": "$54.77", + "dollarPrice": "$0.44", "totalPrice24h": "0BTC", "position": false, "pause": false }] - }, { - "name": "BCH", - "list": [{ - "marketCode": "BCHUSDT", - "marketName": "BCHUSDT永续", - "price24h": "", - "priceLast": "", - "percent": "", - "dollarPrice": "", - "position": false, - "pause": true - }, { - "marketCode": "BCHBTC", - "marketName": "BCHBTC永续", - "price24h": "", - "priceLast": "", - "percent": "", - "dollarPrice": "", - "position": false, - "pause": false - }, { - "marketCode": "BCHETH", - "marketName": "BCHETH永续", - "price24h": "", - "priceLast": "", - "percent": "", - "dollarPrice": "", - "position": false, - "pause": false - }] - }], "ret": "0", "errCode": "0", "errStr": "success" + }], "ret": 0, "errCode": "", "errStr": "" }) }, //最新成交 - 'Post /mock/api/v1/quote/contract.deals': (req, res) => { + 'Get /mock/api/v1/gateway/Home/GetDeals': (req, res) => { + // res.send(401) res.send({ "head": { "method": "market.deals", @@ -189,7 +147,7 @@ export default delay({ }) }, //委托列表 - 'Post /mock/api/v1/quote/contract.order_book': (req, res) => { + 'Post /mock/api/v1/gateway/OrderBook/Index': (req, res) => { res.send({ "head": { "method": "contract.order_book", @@ -207,16 +165,18 @@ export default delay({ const res = _.random(10000, 20000) return { "exist": ['0', '1'][_.random(0, 1)], - "orderPrice": index + 10 + _.random(10, 20), + "orderPrice": index * 100 + 10000 + _.random(1, 20), "orderQuantityShow": res,//randomStr() "orderQuantity": res,//randomStr() } }), + asksFilter: "20116.0", + bidsFilter: "10", "bids": randomArrayMap(5).map((item, index) => { const res = _.random(10000, 20000) return { "exist": ['0', '1'][_.random(0, 1)], - "orderPrice": index + 10 + _.random(10, 20), + "orderPrice": index * 80 + 8000 + _.random(1, 20), "orderQuantityShow": res,//randomStr() "orderQuantity": res,//randomStr() } @@ -225,71 +185,57 @@ export default delay({ ...other }) }, + + //委托区间 + 'Get /mock/api/v1/gateway/OrderBook/Intervals': (req, res) => { + res.send({ + "data": { + "contractCode": "BTCUSDT", + "contractName": "BTCUSDT永续", + "intervals": ["0.5", "5", "10", "50"] + }, "ret": 0, "errCode": "", "errStr": "" + }) + }, //用户的委托列表 - 'Post /mock/api/v1/trade/user.active_delegate': (req, res) => { - const { pageIndex, pageSize } = _.get(req.body, 'param') + 'Get /mock/api/v1/gateway/User/OpenOrders': (req, res) => { res.send({ - "head": { - "method": "user.active_delegate", - "userId": "3", - "userToken": "user.QC5LTHR6HOUZINUCE4YI.web", - "lang": "cn", - "request": "request", - "packType": "1", - "version": "1.0", - "timestamps": "1532175227023967", - "serialNumber": "49", - "msgType": "response" - }, - "data": (new Array(Number(3))).fill({}).map((item, index) => ({ - "orderId": String(index), - "marketName": 'BTCUSDT永续', - "market": "BTCUSDT" + '第' + pageIndex + '页', - "source": "我是现价测试单", - "type": _.random('1', '2'), - "side": _.random('1', '2'), - "userId": "3", - "ctime": "20:18:12", - "mtime": "20:18:12", - "price": "6", - "amount": _.random('5', '-5'), - "taker_fee": "0.01", - "maker_fee": "0.01", - "left": "2", - "deal_stock": "0", - "deal_money": "0", - "deal_fee": "0", - "takerFee": "0.01", - "makerFee": "0.01", - "dealAmount": "0", - "dealMoney": "0", - "dealFee": "0", - "orderStatus": ['1', '2', '3'][_.random(0, 3)], - "leverage": "10", - "avgDealMoney": "0", - "delegateMoney": "0.006" - })), - ...other + "data": (new Array(3)).fill().map(item => ( + { + "orderId": 870, + "contractCode": "BTCUSDT", + "contractName": "BTCUSDT永续", + "type": "1", + "side": "2", + "sideDisplay": "买入", + "ctime": "2018-09-03 10:18:02", + "mtime": "2018-09-03 10:18:02", + "orderQuantity": ["+", "-"][_.random(0, 1)] + _.random(1, 10), + "leftQuantity": "1", + "fillQuantity": "0", + "orderStatus": ['1', '2', '3'][_.random(0, 3)], + "orderStatusDisplay": "等待成交", + "orderPrice": "0.5", + "leverage": "20.00", + "fee": "0.0000BTC", + "avgFillMoney": "0.00", + "orderMargin": "0.0000BTC" + } + )), + "ret": 0, "errCode": "", "errStr": "" }) }, //用户的委托明细 - 'Post /mock/api/v1/trade/order.deals': (req, res) => { - + 'Get /mock/api/v1/gateway/User/OrderDeals': (req, res) => { res.send({ - "data": { - "total": "0", - "records": (new Array(20)).fill().map(item => ( - { - "time": "2018-08-02 17:49:27", - "role": "2", - "price": "222", - "amount": "11", - "fee": "0.0004954954954955" - } - )), - "pageIndex": "0", - "pageSize": "100" - }, + "data": (new Array(20)).fill().map(item => ( + { + "time": "2018-08-02 17:49:27", + "role": "2", + "fillPrice": "222", + "fillQuantity": `${['+', '-'][_.random(0, 1)]}11`, + "fee": "0.0004954954954955" + } + )), "head": { "method": "order.deals", "userId": "3", @@ -305,7 +251,7 @@ export default delay({ }) }, //用户持仓 - 'Post /mock/api/v1/trade/user.position': (req, res) => { + 'Get /mock/api/v1/gateway/User/Positions': (req, res) => { res.send({ "head": { "method": "user.position", @@ -318,69 +264,44 @@ export default delay({ "userId": "56", "userToken": "56" }, - "data": { - "positionList": (new Array(5)).fill().map((item, index) => { - const arryas = ['BTC', 'USDT', 'EOC', 'w', 'b'] - return { - amount: "-1227304", - averagePrice: _.random(10, 50) + '', - averagePriceShow: "234.75", - floatProfit: "-5035.2689034148", - floatProfitShow: "-5035.2689BTC", - keepMoney: "29.8839175526", - keepMoneyShow: "29.8839BTC", - lastPrice: "6000.0", - lastPriceShow: "6000.0", - leverage: "20.00", - market: arryas[index], - marketName: `${arryas[index]}永续`, - overPrice: "245.8305757134", - overPriceShow: "245.83", - positionMoney: "265.3165163631", - positionMoneyShow: "265.3165BTC", - profitRate: "-1897.83%", - reasonablePrice: "6370.8808454090", - reasonablePriceShow: _.random(10, 50) + '', - } - }), - }, + "data": (new Array(3)).fill().map((item, index) => { + const arryas = ['BTC', 'USDT', 'EOC', 'w', 'b'] + return { + "allowFullClose": false, + "contractCode": arryas[index], + "contractName": "BTCUSDT永续", + "leverage": "20.00", + "contractValue": "1", + "maintMarginRate": "0.005", + "takerFee": "0.00075", + "positionQuantity": ["+", "-"][_.random(0, 1)] + _.random(10, 100), + "entryPrice": "6602.70", + "positionMargin": "0.0000BTC", + "liquidationPrice": "6564.77", + "maintMargin": "-1403.6722BTC", + "unrealisedPnl": ["+", "-"][_.random(0, 1)] + _.random(100, 1000) + 'BTC', + "unrealisedPnlPcnt": ["+", "-"][_.random(0, 1)] + _.random(100, 1000) + '%', + "fairPrice": "6713.2", + "lastPrice": "6713.2" + } + }), ...other }) }, //查询持仓占用保证金 - 'Post /mock/api/v1/trade/user.append_position_margin_query': (req, res) => { + 'Get /mock/api/v1/gateway/User/AppendPositionMarginQuery': (req, res) => { res.send({ - "head": { - "method": "user.append_position_margin_query", - "userId": "3", - "userToken": "user.QC5LTHR6HOUZINUCE4YI.pcweb", - "lang": "cn", - "packType": "1", - "version": "1.0", - "msgType": "response", - "timestamps": "1534259459422383", - "serialNumber": "1369" - }, "data": { - "increase": { - "maxChange": "-97880319.9709580707", - "overPrice": "245.9290217635" - }, - "reduce": { - "maxChange": "0.0000000000", - "overPrice": "245.9290217635" - }, + "increase": { "maxChange": "7.9987BTC", "liquidationPrice": "1000000.00" }, + "reduce": { "maxChange": "2.0000BTC", "liquidationPrice": "1000000.00" }, "dealcurrency": "BTC" - }, - "errCode": "0", - "errStr": "success", - "ret": "0" + }, "ret": 0, "errCode": "", "errStr": "" }) }, //更新持仓占用保证金 - 'Post /mock/api/v1/trade/position_margin_update': (req, res) => { + 'Post /mock/api/v1/gateway/User/UpdatePositionMargin': (req, res) => { res.send({ "head": { "method": "position_margin_update", @@ -399,7 +320,7 @@ export default delay({ }) }, //用户撤单 - 'Post /mock/api/v1/trade/order.cancel': (req, res) => { + 'Get /mock/api/v1/gateway/User/CancelOrder': (req, res) => { res.send({ "head": { "method": "order.cancel", @@ -434,46 +355,22 @@ export default delay({ }, // 查询用户杠杆 - 'Post /mock/api/v1/trade/market.leverage_select': (req, res) => { + 'Get /mock/api/v1/gateway/Trade/GetLeverageSetting': (req, res) => { res.send({ - "ret": "0", - "errCode": "0", - "errStr": "Success", "data": { - "leverage": 10.0, - "isModify": true, + "leverage": 10.0000 + '', + "editable": true, "varyRange": "0.5 5 10 50", - "leverages": [{ - "id": 1, - "settingId": 1, - "initialMarginRate": 10.0, - "leverage": 10.0, - "createdTime": "2018-07-17 18:39:28", - "creator": 1 - }, { - "id": 2, - "settingId": 1, - "initialMarginRate": 20.0, - "leverage": 5.0, - "createdTime": "2018-07-17 18:39:28", - "creator": 1 - }, { - "id": 3, - "settingId": 1, - "initialMarginRate": 5.0, - "leverage": 20.0, - "createdTime": "2018-07-17 18:39:28", - "creator": 1 - }, { - "id": 10, - "settingId": 1, - "initialMarginRate": 2.0, - "leverage": 50.0, - "createdTime": "2018-08-05 10:53:24", - "creator": 1 - }], - "keepBailRate": "0.5%" - } + "maintenanceMarginRate": '0.5%', + "leverages": [1, 6, 3, 4, 15, 10, 7, 8, 50].map((item, index) => ( + { + "initialMarginRate": "20", + "initialMarginRateDisplay": "20%", + "leverage": item + '', + "leverageDisplay": `${item}倍` + } + )) + }, "ret": 0, "errCode": "", "errStr": "" }) }, @@ -484,8 +381,8 @@ export default delay({ "userAllowTrade": true, "marketAllowTrade": true, "marketCode": "BTCUSDT", - "minPriceMovement": 0.000000001, - "minPriceMovementDisplay": "0.000000001", + "minPriceMovement": 0.5, + "minPriceMovementDisplay": "0.5BTC", "maintenanceMarginRate": 0.005, "maintenanceMarginRateDisplay": "0.005%", "minTradeNum": 1, @@ -493,7 +390,7 @@ export default delay({ "availableBalance": _.random(10, 10000), "availableBalanceDisplay": "12345.0987BTC", "maxBuyPrice": 6296.1, - "minPricePrecision": 9, + "minPricePrecision": 7, "minSellPrice": 5929.3, "orderValue": _.random(10, 10000), "orderValueDisplay": _.random(10, 10000) + 'BTC', @@ -537,7 +434,7 @@ export default delay({ }, // 设置杠杆 - 'Post /mock/api/v1/trade/market.leverage_set': (req, res) => { + 'Get /mock/api/v1/gateway/Trade/SetLeverage': (req, res) => { res.send({ "errCode": "0", "errStr": "success", @@ -546,8 +443,8 @@ export default delay({ }, //k线图 - 'Post /mock/api/v1/quote/market.kline': (req, res) => { - const { body: { param: { startTime, endTime } = {} } = {} } = req + 'Get /mock/api/v1/gateway/Home/KLines': (req, res) => { + const { query: { startTime, endTime } = {} } = req const periods = helper.getdays(startTime * 1000, endTime * 1000) res.send({ "head": { @@ -559,56 +456,39 @@ export default delay({ "packType": "1", "serialNumber": "56" }, - "data": { - "records": periods.map(item => { - const h = _.random(30, 40) - const o = _.random(10, 20) - const c = _.random(10, 30) - const l =_.random(10, 20) - const v = _.random(100, 3000) - // const h = 160 + _.random(30, 40) - // const o = h - _.random(10, 20) - // const c = o - _.random(10, 30) - // const l = c - _.random(10, 20) - // const v = _.random(100, 3000) - return [item / 1000, o, c, h, l, v, 6, 'BTCUSD永续'] - }), - }, + "data": periods.map(item => { + const h = _.random(30, 40) + const o = _.random(10, 20) + const c = _.random(10, 30) + const l = _.random(10, 20) + const v = _.random(100, 3000) + return [item / 1000, o, c, h, l, v] + }), "errCode": "0", "errStr": "success", "ret": "0" }) }, - //k线图数据详情 - 'Post /mock/api/v1/quote/market.detail': (req, res) => { - const { body: { param: { startTime, endTime } = {} } = {} } = req - const periods = helper.getdays(startTime * 1000, endTime * 1000) + //k线图依赖数据详情 + 'Get /mock/api/v1/gateway/Home/ContractSummary': (req, res) => { + res.send({ - "head": { - "method": "market.kline", - "timestamps": "1533181070062", - "version": "1.0", - "lang": "cn", - "msgType": "request", - "packType": "1", - "serialNumber": "56" - }, "data": { - "maxPrice24h": randomStr(100, 1000), - "minPrice24h": randomStr(100, 1000), - "totalPrice24h": randomStr(10000, 100000), - reasonablePrice: randomStr(10000, 100000), - "marketPrice": "7388.47741901", - "percent": "0.00%", - "dollarPrice": randomStr(100, 1000), - "price24h": randomStr(100, 1000), - "priceLast": '+' + randomStr(100, 1000), - "marketName": "BTCUSDT永续" - }, - "errCode": "0", - "errStr": "success", - "ret": "0" + "contractCode": "BTCUSDT", + "contractName": "BTCUSDT永续", + "allowTrade": true, + "pause": false, + "lastPrice": "+6700.0", + "lastPriceToUSD": "$6700.00", + "direction": 0, + "changePercent24": "0.00%", + "marketPrice": "7276.60", + "fairPrice": "6713.22", + "price24Max": "6700.0", + "price24Min": "6700.0", + "amount24h": "0BTC" + }, "ret": 0, "errCode": "", "errStr": "" }) }, @@ -693,40 +573,39 @@ export default delay({ }, //最近委托历史 - 'Post /mock/api/v1/trade/user.order_history': (req, res) => { - const { pageIndex, pageSize = 10, typeList = [] } = req.body.param + 'Post /mock/api/v1/gateway/User/HistoryOrders': (req, res) => { + const { typeList = [] } = req.body.param + const { page: pageIndex = 1, limit: pageSize = 10, } = req.query const type = typeList[0] - const total = Number(type) * 20 + 30 + const total = 200 const records = (new Array(pageIndex ? total : 3)).fill().map((item, index) => ( { - "ctime": "2018-08-09 17:06:27", - "ftime": "2018-08-09 17:06:46", - "orderId": "19654" + index, - "user": "3", - "marketName": 'BTCUSDT永续' + (index), - "market": "BTCUSDT", - "source": "浏览器,我是现价测试买单,数量10,价格6118.5,用户id:3,邮箱:xiaoyi.wei@bcsystech.com", + "orderId": 886, + "contractCode": "BTCUSDT", + "contractName": "BTCUSDT永续", "type": "1", - "side": "2", - "price": "6118.50", - "amount": "10", - "dealAmount": "5", - "dealMoney": "0.0008171937566397", - "dealFee": "-0.00", + "side": "1", + "sideDisplay": "卖出", + "ctime": "2018-09-04 17:56:36", + "ftime": "2018-09-04 17:56:36", + "orderQuantity": ["+", "-"][_.random(0, 1)] + _.random(1, 10), + "fillQuantity": "0", "orderStatus": ['1', '2', '3'][_.random(0, 3)], + "orderStatusDisplay": "已撤销", + "orderPrice": "7890.0", "leverage": _.random(10, 90) + '', - "avgDealMoney": "6118.5", - "delegateMoney": "0.00004209", - "unwindProfit": "--" + "fee": "--", + "avgFillMoney": "--", + "closePosPNL": "--" } )) res.send( { "data": { - "total": records.length + '', - "records": records.slice(Number(pageIndex) * pageSize, (Number(pageIndex) + 1) * pageSize), - "pageIndex": "", - "pageSize": "10" + "totalCount": records.length + '', + "result": records.slice(Number(pageIndex) * pageSize, (Number(pageIndex) + 1) * pageSize), + "page": pageIndex, + "pageSize": pageSize }, "head": { "method": "user.order_history", @@ -746,8 +625,8 @@ export default delay({ ) }, - //下限价单 - 'Post /mock/api/v1/trade/order.put_limit': (req, res) => { + //下限价、市价单 + 'Post /mock/api/v1/gateway/User/Order ': (req, res) => { res.send( { "data": '', @@ -758,8 +637,8 @@ export default delay({ ) }, - //下市价单 - 'Post /mock/api/v1/trade/order.put_market': (req, res) => { + //全平 + 'Post /mock/api/v1/gateway/User/FullClose': (req, res) => { res.send( { "data": '', @@ -770,6 +649,463 @@ export default delay({ ) }, + //概况 + 'Get /mock/api/v1/gateway/Trade/Summary': (req, res) => { + res.send( + { + "data": { + "summary": { + "profitRate": "-31.98% ", + "totalWealth": "9.67954696", + "totalWealthUSD": "65030.61USD", + "floatProfit": "+0.00009094", + "floatProfitUSD": "-0.61USD", + "availableBalance": "9.99896705", + "availableBalanceUSD": "67176.59USD" + }, + "detail": [{ + "assetName": "BTC", + "assetLogoUrl": "http://hopex.com/api/v1/gateway/files/logos/btc.png", + "floatProfit": "-0.00009094", + "floatProfitUSD": "-0.61USD", + "profitRate": "-0.32% ", + "totalWealth": "9.67954696", + "totalWealthUSD": "65030.61USD", + "availableBalance": "9.99896705", + "availableBalanceUSD": "67176.59USD", + "positionMargin": "0.00028439", + "positionMarginUSD": "1.91USD", + "delegateMargin": "0.00005753", + "delegateMarginUSD": "0.39USD", + "withdrawFreeze": "0.00000000", + "withdrawFreezeUSD": "0.00USD", + "walletBalance": "9.99930897", + "walletBalanceUSD": "67178.88USD" + }, { + "assetName": "ETH", + "assetLogoUrl": "http://hopex.com/api/v1/gateway/files/logos/eth.png", + "floatProfit": "0.00000000", + "floatProfitUSD": "0.00USD", + "profitRate": "0.00% ", + "totalWealth": "0.00000000", + "totalWealthUSD": "0.00USD", + "availableBalance": "0.00000000", + "availableBalanceUSD": "0.00USD", + "positionMargin": "0.00000000", + "positionMarginUSD": "0.00USD", + "delegateMargin": "0.00000000", + "delegateMarginUSD": "0.00USD", + "withdrawFreeze": "0.00000000", + "withdrawFreezeUSD": "0.00USD", + "walletBalance": "0.00000000", + "walletBalanceUSD": "0.00USD" + }, { + "assetName": "USDT", + "assetLogoUrl": "http://hopex.com/api/v1/gateway/files/logos/eth.png", + "floatProfit": "0.00000000", + "floatProfitUSD": "0.00USD", + "profitRate": "0.00% ", + "totalWealth": "0.00000000", + "totalWealthUSD": "0.00USD", + "availableBalance": "0.00000000", + "availableBalanceUSD": "0.00USD", + "positionMargin": "0.00000000", + "positionMarginUSD": "0.00USD", + "delegateMargin": "0.00000000", + "delegateMarginUSD": "0.00USD", + "withdrawFreeze": "0.00000000", + "withdrawFreezeUSD": "0.00USD", + "walletBalance": "0.00000000", + "walletBalanceUSD": "0.00USD" + }] + }, "ret": 0, "errCode": "", "errStr": "" + } + ) + }, + + //存款 + 'Get /mock/api/v1/User/GetUserAssetWalletAddr': (req, res) => { + const asset = req.query.asset + let sendasset + if (asset === 'BTC') { + sendasset = { + "qrCodeImgUrl": "https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/home/img/qrcode/zbios_efde696.png", + "address": "18WY7rBJYnNL16UzG4omYjqUy9jJHnoPo9", + "prompts": ["* 请不要向上述地址充值任何非BTC资产,否则将不可找回。", "* 最低存款额为 0.001BTC (100000 聪)。", "* 你的比特币会在6个网络确认后到帐。", "* 所有Hopex的存款地址都是多重签名冷钱包地址,所有钱包均不曾被联网的机器读取。"] + } + } else { + sendasset = { + "qrCodeImgUrl": "https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/home/img/qrcode/zbios_efde696.png", + "address": "0xf0e1abd140d9e7df1bcf06f9879b0d3b76deee06", + "prompts": ["* 请不要向上述地址充值任何非ETH资产,否则将不可找回。", "* 最低存款额为 0.01ETH。", "* 你的ETH会在30个网络确认后到帐。", "* 所有Hopex的存款地址都是多重签名冷钱包地址,所有钱包均不曾被联网的机器读取。"] + } + } + res.send( + { + "data": sendasset, "ret": 0, "errCode": "", "errStr": "" + } + ) + }, + + + //提现获取依赖详情 + 'Get /mock/api/v1/User/GetWithdrawParameter': (req, res) => { + const asset = req.query.asset + let sendasset + if (asset === 'BTC') { + sendasset = { + "enableTwoFactories": true, + "commission": "0.00100000", + "minAmount": "0.01000000", + "maxAmount": "9.99896705", + "allowWithdraw": true, + "prompts": ["最小提现数量为:0.01000000BTC", "请勿直接提现至众筹或ICO地址.我们不会处理未来代币的发放。", "* 基于安全理由,Hopex每日只会人工审核并处理提现一次,有关我们的政策请参阅安全规范。", "* 在 13:00 UTC (大约 10 小时) 前提交的提款请求,会进入当天的批处理队列。"], + "isValid": true + } + } else { + sendasset = { + "enableTwoFactories": false, + "commission": "0.00500000", + "minAmount": "0.05000000", + "maxAmount": "0.00000000", + "allowWithdraw": true, + "prompts": ["最小提现数量为:0.05000000ETH", "请勿直接提现至众筹或ICO地址.我们不会处理未来代币的发放。", "* 基于安全理由,Hopex每日只会人工审核并处理提现一次,有关我们的政策请参阅安全规范。", "* 在 13:00 UTC (大约 10 小时) 前提交的提款请求,会进入当天的批处理队列。"], + "isValid": true + } + } + res.send( + { + "data": sendasset, "ret": 0, "errCode": "", "errStr": "" + } + ) + }, + + //发送提现确认邮件 + 'Post /mock/api/v1/User/SendEmailToWithdraw': (req, res) => { + res.send( + // { + // "ret": -1, "errCode": "", "errStr": "请先开启谷歌验证" + // } + { "data": true, "ret": 0, "errCode": "", "errStr": "" } + ) + + }, + + //提现申请 + 'Post /mock/api/v1/User/WithdrawApply': (req, res) => { + res.send( + { "data": true, "ret": 0, "errCode": "", "errStr": "" } + ) + + }, + + //获取资金记录 + 'Get /mock/api/v1/User/GetTrans': (req, res) => { + const { page: pageIndex, limit: pageSize = 10, } = req.query + const total = 99 + const records = (new Array(total)).fill().map((item, index) => ( + { + "asset": "BTC", + "type": ["提现", '存款'][_.random(0, 1)], + "status": ["进行中", '已完成', '已拒绝'][_.random(0, 2)], + "statusVal": 0, + "amount": "-1.00000000BTC", + "createdTime": "2018-09-01 16:19:55" + index, + "txid": "222222222223333333333", + "addr": "wwwwwwwwwwwwwwwwwwwww444444444444444444444222", + "addrUrl": "https://btc.com/", + "txidUrl": "https://btc.com/" + } + )) + res.send( + { + "data": { + "totalCount": records.length, + "page": 1, + "pageSize": pageSize, + "result": records.slice(Number(pageIndex - 1) * pageSize, (Number(pageIndex)) * pageSize), + }, "ret": 0, "errCode": "", "errStr": "" + } + ) + + }, + + //网络状态 + 'Head /mock/api/v1/gateway/home/ping': (req, res) => { + res.sendStatus(200) + }, + + //实名认证 + 'Post /mock/api/v1/gateway/Certification/IdCardVerify': (req, res) => { + users_vertify.idCard = { + "realName": "魏晓一", + "idCardNo": "421***********1750", + "name": "实名认证", + "code": "IdCard", + "verified": true + } + res.send( + { "data": true, "ret": 0, "errCode": "", "errStr": "" } + ) + }, + + //银行卡认证 + 'Post /mock/api/v1/gateway/Certification/BankVerify': (req, res) => { + users_vertify.bank = { + "idCardVerified": true, + "owner": "魏晓一", + "bankNo": "**** **** **** 0899", + "bankName": "CMB-招商银行", + "name": "银行卡", + "code": "Bank", + "verified": true + } + res.send( + { "data": true, "ret": 0, "errCode": "", "errStr": "" } + ) + }, + + //个高级认证获取实名认证和银行卡的信息 + 'Get /mock/api/v1/gateway/Certification/All': (req, res) => { + res.send( + { + "data": users_vertify, "ret": 0, "errCode": "", "errStr": "" + } + ) + + }, + + //费率 + 'Get /mock/api/v1/User/otc/GetToCNYExchangeRate': (req, res) => { + const { coinCode, priceArrow } = req.query + let data + switch (coinCode) { + case 'BTC': { + data = 1 + } + break + case 'ETH': { + data = 2 + } + break + case 'USDT': { + data = 3 + } + break + } + switch (priceArrow) { + case 'BUY': { + data = data + 'buy' + } + break + case 'SELL': { + data = data + 'sell' + } + } + res.send( + { + "data": data, "ret": 0, "errCode": "", "errStr": "" + } + ) + + }, + + //用户购买参数 + 'Get /mock/api/v1/User/otc/GetBuyParameter': (req, res) => { + const { coinCode, priceArrow } = req.query + let data + switch (coinCode) { + case 'BTC': { + data = 1 + } + break + case 'ETH': { + data = 2 + } + break + case 'USDT': { + data = 3 + } + break + } + res.send( + { + "data": { + "minBuyRMB": "100.00", + "maxBuyRMB": "500000.00", + "hasOpenBuyOrder": false, + "forbidden": false, + "idCardVerified": true, + "realName": "魏晓一", + "allowLegalBuy": true, + "remarks": [`* 最小单次买入金额${data}人民币。`, `* 最大单次买入金额${data}人民币。`, "* 付款时使用的银行卡持卡人姓名必须与实名认证一致"] + }, "ret": 0, "errCode": "", "errStr": "" + } + ) + + }, + + //订单记录 + 'Get /mock/api/v1/User/otc/GetOrders': (req, res) => { + const { limit, page: pageIndex } = req.query + const pageSize = limit || 10 + const status = [ + { + a: 'Processing', + b: '进行中' + }, + { + a: 'Success', + b: '完成' + }, + { + a: 'Failure', + b: '失败' + }, + ] + const total = (new Array(200)).fill().map((item, index) => { + const select = status[_.random(0, 3)] || {} + return { + "id": 24, + "amount": "+0.00223185BTC", + "no": "OB201809120022", + "orderType": "Buy", + "orderTypeDisplay": "买入" + index, + "rmbAmount": "100.00CNY", + "bankNo": "--", + "orderStatus": select.a, + "orderStatusDisplay": select.b, + "time": "2018-09-12 20:31:36", + "detailUrl": "https://user.hopex.com/otc/order?orderId=24" + } + + } + ) + res.send( + { + "data": { + "totalCount": total.length, + "page": 1, + "pageSize": pageSize, + "result": total.slice(Number(pageIndex - 1) * pageSize, (Number(pageIndex)) * pageSize) + }, "ret": 0, "errCode": "", "errStr": "" + } + ) + + }, + + //卖出参数 + 'Get /mock/api/v1/User/otc/GetSellParameter': (req, res) => { + const { coinCode, priceArrow } = req.query + let data + switch (coinCode) { + case 'BTC': { + data = 1 + } + break + case 'ETH': { + data = 2 + } + break + case 'USDT': { + data = 3 + } + break + } + res.send( + { + "data": { + "userEmail": "xiaoyi.wei@bcsystech.com", + "allowLegalSell": true, + "idCardVerified": false, + "bankVerified": true, + "realName": "魏晓一", + "bankName": "CMB-招商银行", + "bankNo": "**** **** **** 0899", + "forbidden": false, + "minSellAmount": "0.00100000",// + "maxSellAmount": "573.49949427", + "enableTwoFactories": true, + "changePwdIn24h": false, + "disabledTwoFactoriesIn24h": false, + "remarks": [`* 最小单次卖出数量${data}BTC。`] + }, "ret": 0, "errCode": "", "errStr": "" + } + ) + + }, + + //买入 + 'post /mock/api/v1/User/otc/Buy': (req, res) => { + res.send({ + data: 'https://www.baidu.com', "ret": 0, "errCode": "", "errStr": "" + }) + }, + + //提现发送邮箱验证码 + 'post /mock/api/v1/User/otc/SendEmailToOTCWithdraw': (req, res) => { + res.send({ + data: true, "ret": 0, "errCode": "", "errStr": "" + }) + }, + + //解释说明---------------- + 'get /mock/Contract/Index': (req, res) => { + res.send({ + "data": [{ + "direct": "Forward", + "code": "BTCUSDT", + "name": "BTCUSDT永续", + "type": "永续合约", + "closeCurrency": "USDT" + }, { + "direct": "Reverse", + "code": "BTCUSD", + "name": "BTCUSD永续", + "type": "永续合约", + "closeCurrency": "BTC" + }, { + "direct": "Forward", + "code": "ETHUSDT", + "name": "ETHUSDT永续", + "type": "永续合约", + "closeCurrency": "USDT" + }, { "direct": "Reverse", "code": "ETHUSD", "name": "ETHUSD永续", "type": "永续合约", "closeCurrency": "ETH" }], + "ret": 0, + "errCode": "", + "errStr": "" + }) + }, + 'get /mock/Contract/Detail': (req, res) => { + res.send({ + "data": { + "name": "", + "code": "", + "type": "", + "closeCurrency": "", + "price": "", + "marketPrice": "", + "endTime": null, + "closePrice": "", + "value": "", + "minPriceMovement": "", + "minTradeNum": "", + "leverage": "", + "maintenanceMarginRate": "", + "makerRate": "", + "takerRate": "", + "closeAllRate": "", + "deliveryRate": "", + "positionCnt": 0, + "positionVal": "", + "sum24hDealCnt": 0, + "sum24hDealAmount": "", + "sumDealsCnt": 0, + "sumAmount": "" + }, "ret": 0, "errCode": "", "errStr": "" + }) + }, + }, 100) diff --git a/mock/user.js b/mock/user.js index 9293f74..4d70034 100644 --- a/mock/user.js +++ b/mock/user.js @@ -23,10 +23,12 @@ export default delay({ res.send( { data: { - email: '2278095567@qq.com', + email: 'xiaoyi.wei@bcsystech.com', enabledTwoFactories: false, userId: 'mockId', token: "mockToken", + showChain: true, + showLegal: true }, ...other @@ -674,4 +676,36 @@ export default delay({ } ) }, + 'Get /mock/api/v1/User/GetLast10LoginLog': (req, res) => { + res.send( + { + "data": [{ + "time": "2018-09-09 19:16:37", + "ip": "192.168.70.55", + "ipCountry": "局域网" + }, { "time": "2018-09-09 17:54:44", "ip": "111.222.169.90", "ipCountry": "" }, { + "time": "2018-09-09 16:16:56", + "ip": "192.168.70.55", + "ipCountry": "局域网" + }, { "time": "2018-09-09 10:28:14", "ip": "111.222.169.90", "ipCountry": "" }], + "ret": 0, + "errCode": "", + "errStr": "" + } + ) + }, + 'Get /mock/api/v1/User/GetUserInfo': (req, res) => { + res.send( + { + "data": { + "id": 3, + "email": "2278095567@qq.com", + "country": "", + "enabledTwoFactories": true, + "lastLoginTime": "2018-09-10 21:06:20", + "lastLoginIp": "111.222.169.90" + }, "ret": 0, "errCode": "", "errStr": "" + } + ) + }, }, 0) diff --git a/package.json b/package.json index 59f20a2..ab27a82 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "better-scroll": "^1.12.4", "bignumber.js": "^7.2.1", "classnames": "^2.2.6", + "clipboard": "^2.0.1", "dva": "^2.3.1", "dva-loading": "^2.0.3", "dva-model-extend": "^0.1.2", @@ -18,7 +19,6 @@ "fastclick": "^1.0.6", "history": "^4.7.2", "immutable": "^3.8.2", - "is-online": "^7.0.0", "lodash": "^4.17.10", "mock-socket": "^8.0.0", "moment": "^2.22.2", @@ -26,7 +26,7 @@ "path-to-regexp": "^2.2.1", "qs": "^6.5.2", "rc-slider": "^8.6.1", - "react": "^16.2.0", + "react": "^16.4.0", "react-dom": "^16.4.1", "react-draggable": "^3.0.5", "react-loading": "^2.0.3", diff --git a/public/charting_library.min.js b/public/charting_library.min.js index 8a983b9..96994a0 100644 --- a/public/charting_library.min.js +++ b/public/charting_library.min.js @@ -1,310 +1 @@ - - -! - function (t, e) { - "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define.amd ? define(["exports"], e) : e(t.TradingView = t.TradingView || {}) - }(this, - function (t) { - "use strict"; - function e(t, o) { - var i = n({}, - t); - for (var s in o) "object" != typeof t[s] || null === t[s] || Array.isArray(t[s]) ? void 0 !== o[s] && (i[s] = o[s]) : i[s] = e(t[s], o[s]); - return i - } - function o() { - return "1.12 (internal id 7f86d512 @ 2018-02-15 08:36:44.245398)" - } - function i(t) { - window.addEventListener("DOMContentLoaded", t, !1) - } - var n = Object.assign || - function (t) { - for (var e, o = arguments, - i = 1, - n = arguments.length; i < n; i++) { - e = o[i]; - for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]) - } - return t - }, - s = { - mobile: { - disabled_features: ["left_toolbar", "header_widget", "timeframes_toolbar", "edit_buttons_in_legend", "context_menus", "control_bar", "border_around_the_chart"], - enabled_features: [] - } - }, - r = { - width: 800, - height: 500, - symbol: "AA", - interval: "D", - timezone: "UTC", - container_id: "", - library_path: "", - locale: "en", - widgetbar: { - details: !1, - watchlist: !1, - watchlist_settings: { - default_symbols: [] - } - }, - overrides: { - "mainSeriesProperties.showCountdown": !1 - }, - studies_overrides: {}, - brokerConfig: { - configFlags: {} - }, - fullscreen: !1, - autosize: !1, - disabled_features: [], - enabled_features: [], - debug: !1, - logo: {}, - time_frames: [{ - text: "5y", - resolution: "W" - }, - { - text: "1y", - resolution: "W" - }, - { - text: "6m", - resolution: "120" - }, - { - text: "3m", - resolution: "60" - }, - { - text: "1m", - resolution: "30" - }, - { - text: "5d", - resolution: "5" - }, - { - text: "1d", - resolution: "1" - }], - client_id: "0", - user_id: "0", - charts_storage_api_version: "1.0", - favorites: { - intervals: [], - chartTypes: [] - } - }, - a = function () { - function t(t) { - if (this._id = "tradingview_" + (1048576 * (1 + Math.random()) | 0).toString(16).substring(1), this._ready = !1, this._readyHandlers = [], this._onWindowResize = this._autoResizeChart.bind(this), !t.datafeed) throw new Error("Datafeed is not defined"); - if (this._options = e(r, t), t.preset) { - var o = s[t.preset]; - o ? (void 0 !== this._options.disabled_features ? this._options.disabled_features = this._options.disabled_features.concat(o.disabled_features) : this._options.disabled_features = o.disabled_features, void 0 !== this._options.enabled_features ? this._options.enabled_features = this._options.enabled_features.concat(o.enabled_features) : this._options.enabled_features = o.enabled_features) : console.warn("Unknown preset: `" + t.preset + "`") - } - this._create() - } - return t.prototype.onChartReady = function (t) { - this._ready ? t.call(this) : this._readyHandlers.push(t) - }, - t.prototype.onGrayedObjectClicked = function (t) { - this._innerAPI().onGrayedObjectClicked(t) - }, - t.prototype.onShortcut = function (t, e) { - this._innerWindow().createShortcutAction(t, e) - }, - t.prototype.subscribe = function (t, e) { - this._innerAPI().subscribe(t, e) - }, - t.prototype.unsubscribe = function (t, e) { - this._innerAPI().unsubscribe(t, e) - }, - t.prototype.chart = function (t) { - return this._innerAPI().chart(t) - }, - t.prototype.setLanguage = function (t) { - this.remove(), - this._options.locale = t, - this._create() - }, - t.prototype.setSymbol = function (t, e, o) { - this._innerAPI().changeSymbol(t, e + "", o) - }, - t.prototype.remove = function () { - window.removeEventListener("resize", this._onWindowResize), - this._readyHandlers.splice(0, this._readyHandlers.length), - delete window[this._id]; - var t = this._getIFrameElement(); - t.contentWindow.destroyChart(), - t.parentNode && t.parentNode.removeChild(t) - }, - t.prototype.closePopupsAndDialogs = function () { - this._innerAPI().closePopupsAndDialogs() - }, - t.prototype.selectLineTool = function (t) { - this._innerAPI().selectLineTool(t) - }, - t.prototype.selectedLineTool = function () { - return this._innerAPI().selectedLineTool() - }, - t.prototype.save = function (t) { - this._innerAPI().saveChart(t) - }, - t.prototype.load = function (t, e) { - console.log('load!!!!!!'); - this._innerAPI().loadChart({ - json: t, - extendedData: e - }) - }, - t.prototype.getSavedCharts = function (t) { - this._innerAPI().getSavedCharts(t) - }, - t.prototype.loadChartFromServer = function (t) { - this._innerAPI().loadChartFromServer(t) - }, - t.prototype.saveChartToServer = function (t, e, o, i) { - this._innerAPI().saveChartToServer(t, e, o, i) - }, - t.prototype.removeChartFromServer = function (t, e) { - this._innerAPI().removeChartFromServer(t, e) - }, - t.prototype.onContextMenu = function (t) { - this._innerAPI().onContextMenu(t) - }, - t.prototype.createButton = function (t) { - return this._innerWindow().createButton(t) - }, - t.prototype.showNoticeDialog = function (t) { - this._innerAPI().showNoticeDialog(t) - }, - t.prototype.showConfirmDialog = function (t) { - this._innerAPI().showConfirmDialog(t) - }, - t.prototype.showLoadChartDialog = function () { - this._innerAPI().showLoadChartDialog() - }, - t.prototype.showSaveAsChartDialog = function () { - this._innerAPI().showSaveAsChartDialog() - }, - t.prototype.symbolInterval = function () { - return this._innerAPI().getSymbolInterval() - }, - t.prototype.mainSeriesPriceFormatter = function () { - return this._innerAPI().mainSeriesPriceFormatter() - }, - t.prototype.getIntervals = function () { - return this._innerAPI().getIntervals() - }, - t.prototype.getStudiesList = function () { - return this._innerAPI().getStudiesList() - }, - t.prototype.addCustomCSSFile = function (t) { - this._innerWindow().addCustomCSSFile(t) - }, - t.prototype.applyOverrides = function (t) { - this._options = e(this._options, { - overrides: t - }), - this._innerWindow().applyOverrides(t) - }, - t.prototype.applyStudiesOverrides = function (t) { - this._innerWindow().applyStudiesOverrides(t) - }, - t.prototype.watchList = function () { - return this._innerAPI().watchlist() - }, - t.prototype.activeChart = function () { - return this._innerAPI().activeChart() - }, - t.prototype.chartsCount = function () { - return this._innerAPI().chartsCount() - }, - t.prototype.layout = function () { - return this._innerAPI().layout() - }, - t.prototype.setLayout = function (t) { - this._innerAPI().setLayout(t) - }, - t.prototype._getIFrameElement = function () { - var t = document.getElementById(this._id); - if (null === t) throw new Error("There is no such iframe"); - return t - }, - t.prototype._innerAPI = function () { - return this._getIFrameElement().contentWindow.tradingViewApi - }, - t.prototype._innerWindow = function () { - return this._getIFrameElement().contentWindow - }, - t.prototype._autoResizeChart = function () { - this._options.fullscreen && (this._getIFrameElement().style.height = window.innerHeight + "px") - }, - t.prototype._create = function () { - var t = this, - e = this._render(), - o = document.getElementById(this._options.container_id); - if (null === o) throw new Error("There is no such element - #" + this._options.container_id); - o.innerHTML = e; - var i = this._getIFrameElement(); (this._options.autosize || this._options.fullscreen) && (i.style.width = "100%", this._options.fullscreen || (i.style.height = "100%")), - window.addEventListener("resize", this._onWindowResize), - this._onWindowResize(); - var n = function () { - i.removeEventListener("load", n, !1), - console.log('i.contentWindow ->', i.contentWindow); - i.contentWindow.widgetReady(function () { - t._ready = !0; - for (var e = 0, - o = t._readyHandlers; e < o.length; e++) { - o[e].call(t) - } - i.contentWindow.initializationFinished() - }) - }; - i.addEventListener("load", n, !1) - }, - t.prototype._render = function () { - var t = window; - t[this._id] = { - datafeed: this._options.datafeed, - customFormatters: this._options.customFormatters, - brokerFactory: this._options.brokerFactory, - overrides: this._options.overrides, - studiesOverrides: this._options.studies_overrides, - disabledFeatures: this._options.disabled_features, - enabledFeatures: this._options.enabled_features, - brokerConfig: this._options.brokerConfig, - restConfig: this._options.restConfig, - favorites: this._options.favorites, - logo: this._options.logo, - numeric_formatting: this._options.numeric_formatting, - rss_news_feed: this._options.rss_news_feed, - newsProvider: this._options.news_provider, - loadLastChart: this._options.load_last_chart, - saveLoadAdapter: this._options.save_load_adapter, - loading_screen: this._options.loading_screen, - settingsAdapter: this._options.settings_adapter - }, - this._options.saved_data && (t[this._id].chartContent = { - json: this._options.saved_data - }); - var iframeSrc = "static/tv-chart.html"; - var e = (this._options.library_path || "") + iframeSrc + "#localserver=1&symbol=" + encodeURIComponent(this._options.symbol) + "&interval=" + encodeURIComponent(this._options.interval) + (this._options.timeframe ? "&timeframe=" + encodeURIComponent(this._options.timeframe) : "") + (this._options.toolbar_bg ? "&toolbarbg=" + this._options.toolbar_bg.replace("#", "") : "") + (this._options.studies_access ? "&studiesAccess=" + encodeURIComponent(JSON.stringify(this._options.studies_access)) : "") + "&widgetbar=" + encodeURIComponent(JSON.stringify(this._options.widgetbar)) + (this._options.drawings_access ? "&drawingsAccess=" + encodeURIComponent(JSON.stringify(this._options.drawings_access)) : "") + "&timeFrames=" + encodeURIComponent(JSON.stringify(this._options.time_frames)) + "&locale=" + encodeURIComponent(this._options.locale) + "&uid=" + encodeURIComponent(this._id) + "&clientId=" + encodeURIComponent(String(this._options.client_id)) + "&userId=" + encodeURIComponent(String(this._options.user_id)) + (this._options.charts_storage_url ? "&chartsStorageUrl=" + encodeURIComponent(this._options.charts_storage_url) : "") + (this._options.charts_storage_api_version ? "&chartsStorageVer=" + encodeURIComponent(this._options.charts_storage_api_version) : "") + (this._options.indicators_file_name ? "&indicatorsFile=" + encodeURIComponent(this._options.indicators_file_name) : "") + (this._options.custom_css_url ? "&customCSS=" + encodeURIComponent(this._options.custom_css_url) : "") + (this._options.auto_save_delay ? "&autoSaveDelay=" + encodeURIComponent(String(this._options.auto_save_delay)) : "") + "&debug=" + this._options.debug + (this._options.snapshot_url ? "&snapshotUrl=" + encodeURIComponent(this._options.snapshot_url) : "") + (this._options.timezone ? "&timezone=" + encodeURIComponent(this._options.timezone) : "") + (this._options.study_count_limit ? "&studyCountLimit=" + encodeURIComponent(String(this._options.study_count_limit)) : "") + (this._options.symbol_search_request_delay ? "&ssreqdelay=" + encodeURIComponent(String(this._options.symbol_search_request_delay)) : ""); - return '' - }, - t - }(), - d = a; - window.TradingView = window.TradingView || {}, - window.TradingView.version = o, - t.version = o, - t.onready = i, - t.widget = d, - Object.defineProperty(t, "__esModule", { - value: !0 - }) - }); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.TradingView=t.TradingView||{})}(this,function(t){"use strict";function e(t,o){var i=n({},t);for(var s in o)"object"!=typeof t[s]||null===t[s]||Array.isArray(t[s])?void 0!==o[s]&&(i[s]=o[s]):i[s]=e(t[s],o[s]);return i}function o(){return"1.12 (internal id 7580da73 @ 2018-05-14 05:13:04.428607)"}function i(t){window.addEventListener("DOMContentLoaded",t,!1)}var n=Object.assign||function(t){for(var e,o=arguments,i=1,n=arguments.length;i'},t}(),d=a;window.TradingView=window.TradingView||{},window.TradingView.version=o,t.version=o,t.onready=i,t.widget=d,Object.defineProperty(t,"__esModule",{value:!0})}); diff --git a/public/override.css b/public/override.css new file mode 100644 index 0000000..bff4f82 --- /dev/null +++ b/public/override.css @@ -0,0 +1,4 @@ +.layout__area--left > div { + background: transparent !important; +} + diff --git a/public/static/bundles/13.416855bb3e77f54b85bc.js b/public/static/bundles/13.280894673316ad6ac6f2.js similarity index 97% rename from public/static/bundles/13.416855bb3e77f54b85bc.js rename to public/static/bundles/13.280894673316ad6ac6f2.js index c8625e0..7fd3a6a 100644 --- a/public/static/bundles/13.416855bb3e77f54b85bc.js +++ b/public/static/bundles/13.280894673316ad6ac6f2.js @@ -1,4 +1,4 @@ -webpackJsonp([13],{334:function(t,e,n){var o,i,r;!function(a,c){i=[t,n(516),n(1091),n(687)],o=c,void 0!==(r="function"==typeof o?o.apply(e,i):o)&&(t.exports=r)}(0,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var l=i(e),s=i(n),f=i(o),h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d=function(){function t(t,e){var n,o;for(n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===h(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,f.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new l.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return u("action",t)}},{key:"defaultTarget",value:function(t){var e=u("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return u("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),e}(s.default);t.exports=p})},516:function(t,e,n){var o,i,r;!function(a,c){i=[t,n(1090)],o=c, +webpackJsonp([13],{334:function(t,e,n){var o,i,r;!function(a,c){i=[t,n(516),n(1092),n(687)],o=c,void 0!==(r="function"==typeof o?o.apply(e,i):o)&&(t.exports=r)}(0,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var l=i(e),s=i(n),f=i(o),h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d=function(){function t(t,e){var n,o;for(n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===h(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,f.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new l.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return u("action",t)}},{key:"defaultTarget",value:function(t){var e=u("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return u("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),e}(s.default);t.exports=p})},516:function(t,e,n){var o,i,r;!function(a,c){i=[t,n(1091)],o=c, void 0!==(r="function"==typeof o?o.apply(e,i):o)&&(t.exports=r)}(0,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=function(){function t(t,e){var n,o;for(n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t,e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px",t=window.pageYOffset||document.documentElement.scrollTop,this.fakeElem.style.top=t+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target", -set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":r(t))||1!==t.nodeType)throw Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),t}();t.exports=c})},613:function(t,e){function n(t,e){for(;t&&t.nodeType!==i;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}var o,i=9;"undefined"==typeof Element||Element.prototype.matches||(o=Element.prototype,o.matches=o.matchesSelector||o.mozMatchesSelector||o.msMatchesSelector||o.oMatchesSelector||o.webkitMatchesSelector),t.exports=n},614:function(t,e,n){function o(t,e,n,o,i){var a=r.apply(this,arguments);return t.addEventListener(n,a,i),{destroy:function(){t.removeEventListener(n,a,i)}}}function i(t,e,n,i,r){return"function"==typeof t.addEventListener?o.apply(null,arguments):"function"==typeof n?o.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return o(t,e,n,i,r)}))}function r(t,e,n,o){return function(n){n.delegateTarget=a(n.target,e),n.delegateTarget&&o.call(t,n)}}var a=n(613);t.exports=i},686:function(t,e){e.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},e.nodeList=function(t){var n=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in t&&(0===t.length||e.node(t[0]))},e.string=function(t){return"string"==typeof t||t instanceof String},e.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},687:function(t,e,n){function o(t,e,n){if(!t&&!e&&!n)throw Error("Missing required arguments");if(!c.string(e))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(t))return i(t,e,n);if(c.nodeList(t))return r(t,e,n);if(c.string(t))return a(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function i(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function r(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function a(t,e,n){return u(document.body,t,e,n)}var c=n(686),u=n(614);t.exports=o},1090:function(t,e){function n(t){var e,n,o,i;return"SELECT"===t.nodeName?(t.focus(),e=t.value):"INPUT"===t.nodeName||"TEXTAREA"===t.nodeName?(n=t.hasAttribute("readonly"),n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value):(t.hasAttribute("contenteditable")&&t.focus(),o=window.getSelection(), -i=document.createRange(),i.selectNodeContents(t),o.removeAllRanges(),o.addRange(i),e=""+o),e}t.exports=n},1091:function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function o(){i.off(t,o),e.apply(n,arguments)}var i=this;return o._=e,this.on(t,o,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,i=n.length;for(o;o");return this.bindControl(new l(p(e),this._linetool.properties().collectibleColors,!0,this.model(),"Change All Lines Color",0)),{label:$(""+$.t("Use one color")+""),editor:e}},n.prototype.addOneColorPropertyWidget=function(e){var t=this.createOneColorForAllLinesWidget(),o=$("");o.append($("")).append(t.label).append(t.editor),o.appendTo(e)},n=i(n),n.createTemplatesPropertyPage=i,e.exports=n},15:function(e,t,o){"use strict";function i(){return $('
').slider({max:4,min:1,step:1})}Object.defineProperty(t,"__esModule",{value:!0}),o(22),o(285),t.createLineWidthEditor=i},31:function(e,t,o){"use strict";function i(){return new n.Combobox([{html:'
',value:a.LINESTYLE_SOLID},{html:'
',value:a.LINESTYLE_DOTTED},{html:'
',value:a.LINESTYLE_DASHED}])}var n,a;Object.defineProperty(t,"__esModule",{value:!0}),n=o(738),a=o(115),t.createLineStyleEditor=i},65:function(e,t,o){"use strict";function i(e){var t=$('
').slider({max:100,min:0,step:1}),o=["-moz-linear-gradient(left, %COLOR 0%, transparent 100%)","-webkit-gradient(linear, left top, right top, color-stop(0%,%COLOR), color-stop(100%,transparent))","-webkit-linear-gradient(left, %COLOR 0%,transparent 100%)","-o-linear-gradient(left, %COLOR 0%,transparent 100%)","linear-gradient(to right, %COLOR 0%,transparent 100%)"];return t.updateColor=function(e){var i=t.find(".gradient");o.forEach(function(t){i.css("background-image",t.replace(/%COLOR/,e))})},e?(t.updateColor(e.val()||"black"),e.on("change",function(e){t.updateColor(e.target.value)})):t.updateColor("black"),t}Object.defineProperty(t,"__esModule",{value:!0}),o(22),o(285),t.createTransparencyEditor=i},81:function(e,t,o){"use strict";function i(e,t,o){a.call(this,e,t),this._linetool=o,this.prepareLayout()}var n=o(10),a=n.PropertyPage,r=n.GreateTransformer,l=n.LessTransformer,p=n.ToIntTransformer,s=n.SimpleStringBinder;o(142),inherit(i,a),i.BarIndexPastLimit=-5e4,i.BarIndexFutureLimit=15e3,i.prototype.bindBarIndex=function(e,t,o,n){var a=[p(e.value()),r(i.BarIndexPastLimit),l(i.BarIndexFutureLimit)];this.bindControl(new s(t,e,a,!1,o,n))}, -i.prototype.createPriceEditor=function(e){var t,o=this._linetool.ownerSource().formatter(),i=function(e){return o.format(e)},n=function(e){var t=o.parse(e);if(t.res)return t.price?t.price:t.value},a=$("");return a.TVTicker({step:o._minMove/o._priceScale||1,formatter:i,parser:n}),e&&(t=[function(t){var o=n(t);return void 0===o?e.value():o}],this.bindControl(new s(a,e,t,!1,this.model(),"Change "+this._linetool+" point price")).addFormatter(function(e){return o.format(e)})),a},i.prototype._createPointRow=function(e,t,o){var i,n,a,r,l,p=$(""),s=$("");return s.html($.t("Price")+o),s.appendTo(p),i=$(""),i.appendTo(p),n=this.createPriceEditor(t.price),n.appendTo(i),a=$(""),a.html($.t("Bar #")),a.appendTo(p),r=$(""),r.appendTo(p),l=$(""),l.appendTo(r),l.addClass("ticker"),this.bindBarIndex(t.bar,l,this.model(),"Change "+this._linetool+" point bar index"),p},i.prototype.prepareLayoutForTable=function(e){var t,o,i,n,a,r=this._linetool.points(),l=r.length;for(t=0;t1?" "+(t+1):"",a=this._createPointRow(o,i,n),a.appendTo(e))},i.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.prepareLayoutForTable(this._table),this.loadData()},i.prototype.widget=function(){return this._table},e.exports=i},121:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Coordinates=100]="Coordinates",e[e.Display=100]="Display",e[e.Style=200]="Style",e[e.Inputs=300]="Inputs",e[e.Properties=250]="Properties"}(t.TabPriority||(t.TabPriority={})),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.eventsAndAlerts="Events & Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.sourceCode="Source Code",e.style="Style",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility"}(t.TabNames||(t.TabNames={})),function(e){e[e.Default=100]="Default",e[e.UserSave=200]="UserSave",e[e.Override=300]="Override"}(t.TabOpenFrom||(t.TabOpenFrom={}))},208:function(e,t,o){"use strict";function i(e,t,o){r.call(this,e,t),this._study=o,this.prepareLayout()}function n(e,t,o){r.call(this,e,t),this._study=o,this._property=e,this.prepareLayout()}var a=o(10),r=a.PropertyPage,l=a.GreateTransformer,p=a.LessTransformer,s=a.ToIntTransformer,d=a.ToFloatTransformer,h=a.SimpleComboBinder,c=a.BooleanBinder,b=a.DisabledBinder,u=a.ColorBinding,C=a.SliderBinder,y=a.SimpleStringBinder,g=o(47).addColorPicker,w=o(31).createLineStyleEditor,T=o(1121).createShapeLocationEditor,_=o(1122).createShapeStyleEditor,m=o(15).createLineWidthEditor,f=o(1123).createVisibilityEditor,L=o(1119).createHHistDirectionEditor,v=o(476).createPlotEditor,k=o(38).NumericFormatter,S=o(45),P=o(106).PlotType,x=o(13).getLogger("Chart.Study.PropertyPage");inherit(i,r),i.prototype.prepareLayout=function(){function e(e){ +i.prototype.createPriceEditor=function(e){var t,o=this._linetool.ownerSource().formatter(),i=function(e){return o.format(e)},n=function(e){var t=o.parse(e);if(t.res)return t.price?t.price:t.value},a=$("");return a.TVTicker({step:o._minMove/o._priceScale||1,formatter:i,parser:n}),e&&(t=[function(t){var o=n(t);return void 0===o?e.value():o}],this.bindControl(new s(a,e,t,!1,this.model(),"Change "+this._linetool+" point price")).addFormatter(function(e){return o.format(e)})),a},i.prototype._createPointRow=function(e,t,o){var i,n,a,r,l,p=$(""),s=$("");return s.html($.t("Price")+o),s.appendTo(p),i=$(""),i.appendTo(p),n=this.createPriceEditor(t.price),n.appendTo(i),a=$(""),a.html($.t("Bar #")),a.appendTo(p),r=$(""),r.appendTo(p),l=$(""),l.appendTo(r),l.addClass("ticker"),this.bindBarIndex(t.bar,l,this.model(),"Change "+this._linetool+" point bar index"),p},i.prototype.prepareLayoutForTable=function(e){var t,o,i,n,a,r=this._linetool.points(),l=r.length;for(t=0;t1?" "+(t+1):"",a=this._createPointRow(o,i,n),a.appendTo(e))},i.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.prepareLayoutForTable(this._table),this.loadData()},i.prototype.widget=function(){return this._table},e.exports=i},121:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Coordinates=100]="Coordinates",e[e.Display=100]="Display",e[e.Style=200]="Style",e[e.Inputs=300]="Inputs",e[e.Properties=250]="Properties"}(t.TabPriority||(t.TabPriority={})),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.eventsAndAlerts="Events & Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.sourceCode="Source Code",e.style="Style",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility"}(t.TabNames||(t.TabNames={})),function(e){e[e.Default=100]="Default",e[e.UserSave=200]="UserSave",e[e.Override=300]="Override"}(t.TabOpenFrom||(t.TabOpenFrom={}))},208:function(e,t,o){"use strict";function i(e,t,o){r.call(this,e,t),this._study=o,this.prepareLayout()}function n(e,t,o){r.call(this,e,t),this._study=o,this._property=e,this.prepareLayout()}var a=o(10),r=a.PropertyPage,l=a.GreateTransformer,p=a.LessTransformer,s=a.ToIntTransformer,d=a.ToFloatTransformer,h=a.SimpleComboBinder,c=a.BooleanBinder,b=a.DisabledBinder,u=a.ColorBinding,C=a.SliderBinder,y=a.SimpleStringBinder,g=o(47).addColorPicker,w=o(31).createLineStyleEditor,T=o(1122).createShapeLocationEditor,_=o(1123).createShapeStyleEditor,m=o(15).createLineWidthEditor,f=o(1124).createVisibilityEditor,L=o(1120).createHHistDirectionEditor,v=o(476).createPlotEditor,k=o(38).NumericFormatter,S=o(45),P=o(106).PlotType,x=o(13).getLogger("Chart.Study.PropertyPage");inherit(i,r),i.prototype.prepareLayout=function(){function e(e){ return(new k).format(e)}var t,o,n,a,r,l,p,s,b,T,_,f,L,v,P,B,E,R,F,I,A,D,W,O,V,j,z,M,H,q,N,G,U,Y,K,Q;for(this._table=$(""),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=this._study.metaInfo(),o={},n=0;n0)for(n=0;n'),T.appendTo(this._table),_=$("
"),_.appendTo(T),f=$(""),f.appendTo(_),L=$.t(b.name.value(),{context:"input"}),v=this.createLabeledCell(L,f).appendTo(T).addClass("propertypage-name-label"),P=$(""),P.appendTo(T),P.addClass("colorpicker-cell"),B=g(P),E=$(""),E.appendTo(T),R=m(),R.appendTo(E),F=$('').css({whiteSpace:"nowrap"}),F.appendTo(T),I=w(),I.render().appendTo(F),A=$(""),A.appendTo(F),D=[d(b.value.value())],W="Change band",O=new y(A,b.value,D,!1,this.model(),W),O.addFormatter(e),this.bindControl(O),this.bindControl(new c(f,b.visible,!0,this.model(),W)),this.bindControl(new u(B,b.color,!0,this.model(),W)),this.bindControl(new h(I,b.linestyle,parseInt,!0,this.model(),W)),this.bindControl(new C(R,b.linewidth,!0,this.model(),W)));if(this._study.properties().bandsBackground&&(b=this._study.properties().bandsBackground,V=$.t("Background"),W=$.t("Change band background"),T=this._prepareFilledAreaBackground(b.fillBackground,b.backgroundColor,b.transparency,V,W),T.appendTo(this._table)),this._study.properties().areaBackground&&(b=this._study.properties().areaBackground,V=$.t("Background"),W=$.t("Change area background"),T=this._prepareFilledAreaBackground(b.fillBackground,b.backgroundColor,b.transparency,V,W),T.appendTo(this._table)),void 0!==(j=t.filledAreas))for(n=0;n'),_=$(""),_.appendTo(T),f=$(""),f.appendTo(_), this.bindControl(new c(f,b.visible,!0,this.model(),W+" visibility")),this.createLabeledCell(V,f).appendTo(T).addClass("propertypage-name-label"),T.appendTo(this._table),M=this._findPlotPalette(n,z),H=M.palette,q=M.paletteProps,this._prepareLayoutForPalette(0,z,H,q,W)):(T=this._prepareFilledAreaBackground(b.visible,b.color,b.transparency,V,W),T.appendTo(this._table)));for(N in t.graphics){G=t.graphics[N];for(U in G)b=this._property.graphics[N][U],i["_createRow_"+N].call(this,this._table,b)}Y=this._table.find(".visibility-switch.plot-visibility-switch"),1===Y.length&&(_=Y.parent(),_.css("display","none"),v=this._table.find(".propertypage-plot-with-palette"),1===v.length?v.css("display","none"):(v=this._table.find(".propertypage-name-label"),v.css("padding-left",0),v.find("label").attr("for",""))),K=this._prepareStudyPropertiesLayout(),this._table=this._table.add(K),S.isScriptStrategy(t)&&(Q=this._prepareOrdersSwitches(),this._table=this._table.add(Q)),this.loadData()},i.prototype._prepareOrdersSwitches=function(){var e,t,o,i,n,a,r,l=$(''),p="chart-orders-switch_"+Date.now().toString(36),s=$("").appendTo(l),d=$('').appendTo($("").appendTo(l),o=$('').appendTo($("").appendTo(l),a=$('').appendTo($("'),o.appendTo(this._table),i=$("'),o.appendTo(this._table), i=$("');y.appendTo(this._table),o=$("'),a.appendTo(this._table),r=$("');L.appendTo(this._table),o=$("'), @@ -16,7 +16,7 @@ i=$("").appendTo(this._table),$('
").appendTo(s));return $('").appendTo($("").appendTo(s)),e="chart-orders-labels-switch_"+Date.now().toString(36),t=$("
").appendTo(t)),$('").appendTo($("").appendTo(t)),i="chart-orders-qty-switch_"+Date.now().toString(36),n=$("
").appendTo(n)),$('").appendTo($("").appendTo(n)),r=this._study.properties(),this.bindControl(new c(d,r.strategy.orders.visible,!0,this.model(),"Trades on chart visibility")),this.bindControl(new c(o,r.strategy.orders.showLabels,!0,this.model(),"Signal labels visibility")),this.bindControl(new b(o,r.strategy.orders.visible,!0,this.model(),"Signal labels visibility",!0)),this.bindControl(new c(a,r.strategy.orders.showQty,!0,this.model(),"Quantity visibility")),this.bindControl(new b(a,r.strategy.orders.visible,!0,this.model(),"Quantity visibility",!0)),l},i.prototype._prepareLayoutForPlot=function(e,t){var o,i,n,a,r,l,p,s,d,b,y,w,T=t.id,_=this._study.properties().styles[T],f=this._findPlotPalette(e,t),L=f.palette,k=f.paletteProps,S="Change "+T;L?(o=$('
"),i.appendTo(o),i.addClass("visibility-cell"),n=$(""),n.appendTo(i),this.bindControl(new c(n,_.visible,!0,this.model(),S)),a=$.t(_.title.value(),{context:"input"}),this.createLabeledCell(a,n).appendTo(o).addClass("propertypage-name-label propertypage-plot-with-palette"),this._prepareLayoutForPalette(e,t,L,k,S)):(o=$('
"),i.appendTo(o),i.addClass("visibility-cell"),n=$(""),n.appendTo(i),a=$.t(this._study.properties().styles[T].title.value(),{context:"input"}),this.createLabeledCell(a,n).appendTo(o).addClass("propertypage-name-label"),r=$(""),r.appendTo(o),r.addClass("colorpicker-cell"),l=g(r),p=$(""),p.appendTo(o),s=m(),s.appendTo(p),d=$(""),d.appendTo(o),b=v(),b.appendTo(d),y=$(""),y.appendTo(o),w=$(""),w.appendTo(y),this.createLabeledCell("Price Line",w).appendTo(o),this.bindControl(new c(n,_.visible,!0,this.model(),S)),this.bindControl(new u(l,_.color,!0,this.model(),S,_.transparency)),this.bindControl(new C(s,_.linewidth,!0,this.model(),S,this._study.metaInfo().isTVScript)),this.bindControl(new h(b,_.plottype,parseInt,!0,this.model(),S)),this.bindControl(new c(w,_.trackPrice,!0,this.model(),"Change Price Line")))},i.prototype._prepareLayoutForBarsPlot=function(e,t){var o,i,n,a,r,l,p=t.id,s=this._study.properties().ohlcPlots[p],d=this._findPlotPalette(e,t),h=d.palette,b=d.paletteProps,C="Change "+p,y=$('
"),o.appendTo(y),o.addClass("visibility-cell"),i=$(""),i.appendTo(o),this.bindControl(new c(i,s.visible,!0,this.model(),C)),n=s.title.value(),this.createLabeledCell(n,i).appendTo(y).addClass("propertypage-name-label"),h?(a=!0,this._prepareLayoutForPalette(e,t,h,b,C,a)):(r=$(""),r.appendTo(y),r.addClass("colorpicker-cell"),l=g(r),this.bindControl(new u(l,s.color,!0,this.model(),C)))},i.prototype._prepareLayoutForCandlesPlot=function(e,t){var o,i,n,a,r,l,p,s,d;this._prepareLayoutForBarsPlot(e,t),o=t.id,i=this._study.properties().ohlcPlots[o],n="Change "+o,a=$('
"),r.appendTo(a),r.addClass("visibility-cell"),l=$(""),l.appendTo(r),this.bindControl(new c(l,i.drawWick,!0,this.model(),n)),p="Wick",this.createLabeledCell(p,l).appendTo(a),s=$(""),s.appendTo(a),s.addClass("colorpicker-cell"),d=g(s),this.bindControl(new u(d,i.wickColor,!0,this.model(),n))},i.prototype._prepareLayoutForShapesPlot=function(e,t){var o,i,n,a,r,l,p,s,d,b=t.id,C=this._study.properties().styles[b],y=this._findPlotPalette(e,t),w=y.palette,m=y.paletteProps,f="Change "+b,L=$('
"),o.appendTo(L),o.addClass("visibility-cell"),i=$(""),i.appendTo(o),this.bindControl(new c(i,C.visible,!0,this.model(),f)),n=$.t(this._study.properties().styles[b].title.value(),{context:"input"}),this.createLabeledCell(n,i).appendTo(L).addClass("propertypage-name-label"),a=$(""),a.appendTo(L),r=_(),r.appendTo(a),this.bindControl(new h(r,C.plottype,null,!0,this.model(),f)),l=$(""),l.appendTo(L),p=T(),p.appendTo(l),this.bindControl(new h(p,C.location,null,!0,this.model(),f)),w?this._prepareLayoutForPalette(e,t,w,m,f):(L=$('
').append($("