123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title> </title>
- <link rel="stylesheet" href="css/common.css">
- <link rel="stylesheet" href="css/dataMap.css">
- </head>
- <style>
- [v-cloak]{
- display: none !important;
- }
- </style>
- <body>
- <!-- <div class="h20 bgHeader"></div> -->
- <div id="app" v-cloak class="bgBalck">
- <div class="header plr15 flex alcenter bgHeader white fixed pt30">
- <img src="../../static/image/return.png" class="h15 wt15 mr10" @click="goback" />
- <div class="flex alcenter" @click="showLeft">
- <img src="../../static/image/lists.png" style="width: 20px;">
- <span class="white ft18 bold pl10">{{symbol}}</span>
- </div>
- </div>
- <div>
- <div class="pt60 pb10 plr20 bgHeader" style="min-height: 50px;">
- <div class="flex alcenter between pt5">
- <div class="tc" :class="[updown.substring(0,1) == '-'?'red':'green']">
- <p class="bold ft24">{{newprice || '0.00'}}</p>
- <p class="mt10">{{updown ||'0.00'}}%</p>
- </div>
- <div class="w50">
- <div class="flex between mb5">
- <span class="blue">{{translatedInfo.high || '--'}}</span>
- <span class="blue white">{{maxprice || '0.00'}}</span>
- </div>
- <div class="flex between mb5">
- <span class="blue">{{translatedInfo.low || '--'}}</span>
- <span class="blue white">{{minprice ||'0.00'}}</span>
- </div>
- <div class="flex between">
- <span class="blue">{{translatedInfo.volume || '--'}}</span>
- <span class="blue white">{{dayvom ||'0.00'}}</span>
- </div>
- </div>
- </div>
- </div>
- <div id="tv_chart_container" style="width:100%;height:60vh;margin-top: 5px;"></div>
- <!--订单列表 -->
- <div class="order-list">
- <div class="flex order-list-header between">
- <p class="tc" :class="[{'active':status == 1}]" @click="selectOrder(1)" data-localize="contract.positionList">{{texts[lang].list}}</p>
- <p class="tc" :class="[{'active':status == 3}]" @click="selectOrder(3)" data-localize="td.drecord">{{texts[lang].record}}</p>
- </div>
- <p v-show="false">{{CountDown}}</p>
- <ul class="lists">
- <li class="flex between ft10">
- <p data-localize="assets.num">{{texts[lang].num}}</p>
- <p data-localize="contract.purchasePrice">{{texts[lang].buyprice}}</p>
- <p v-show="status == 1" data-localize="deals.nowprice">{{texts[lang].nowprice}}</p>
- <p v-show="status == 3" data-localize="contract.transactionPrice">{{texts[lang].okprice}}</p>
- <p v-show="status == 1" data-localize="contract.estimated">{{texts[lang].estimate}}</p>
- <p v-show="status == 1" data-localize="contract.countDown">{{texts[lang].count}}</p>
- <p v-show="status == 3" data-localize="deals.fee">{{texts[lang].handrate}}</p>
- <p v-show="status == 3" data-localize="contract.profitAndLoss">{{texts[lang].profit}}</p>
- </li>
- <li
- v-if="orderList.length > 0 && item.remain_milli_seconds >0 && status==1 || status ==3 && orderList.length >0"
- v-for="(item,index) in orderList" :key="item.id" class="flex between ft10">
- <!-- 数量 -->
- <!-- <p v-if="item.is_insurance == 1">{{item.number || '0' | toFixedNum}}{{item.currency_name}}{{getlg('just')}}</p>
- <p v-else-if="item.is_insurance == 2">{{item.number || '0' | toFixedNum}}{{item.currency_name}}{{getlg('back')}}</p> -->
- <p>{{item.number || '0' | toFixedNum}}{{item.currency_name}}</p>
- <!-- 购买价 -->
- <p>{{item.open_price || '0.00' | toFixed4}}
- <img v-if="item.type == 1" width="10" src="./image/buy.png" alt="">
- <img v-else width="10" src="./image/sell.png" alt="">
- </p>
- <!-- 当前价 -->
- <p v-if="status == 1&&item.status == 1">{{newprice || '0.00' | toFixed4}}</p>
- <!-- 成交价 -->
- <p v-if="status == 1&&item.status == 3">{{item.end_price || '0.00' | toFixed4}}</p>
- <p v-if="status == 3&&item.remain_milli_seconds>0">--</p>
- <p v-if="status == 3&&item.remain_milli_seconds<=0">{{item.end_price || '0.00' | toFixed4}}</p>
- <p v-if="status == 1&&item.status == 1 && (item.open_price -0) == (newprice -0)" class="green">0</p>
- <p v-if="status == 1&&item.status == 1 && item.type == 1 && (item.open_price -0) > (newprice -0)" class="red">
- -{{item.number || '0' | toFixedNum}}</p>
- <p v-if="status == 1&&item.status == 1 && item.type == 1 && (item.open_price -0) < (newprice -0)" class="green">
- {{(item.number * item.profit_ratio -0) /100 || '0.00' | toFixedNum}}</p>
- <p v-if="status == 1&&item.status == 1 && item.type == 2 && (item.open_price -0) > (newprice -0)" class="green">
- {{(item.number * item.profit_ratio -0) /100 || '0.00' | toFixedNum}}</p>
- <p v-if="status == 1&&item.status == 1 && item.type == 2 && (item.open_price -0) < (newprice -0)" class="red">
- -{{(item.number -0) || '0.00' | toFixedNum}}</p>
- <p v-if="status == 1&&item.status == 3" :class="item.fact_profits >= 0?'green':'red'">{{item.fact_profits || '0' | toFixedNum}}</p>
- <p v-if="status == 1&&item.status == 1" class="times">
- {{countDown(item.endTime,index,item.seconds,item.remain_milli_seconds,item.id)}}s</p>
- <p v-if="status == 1&&item.status == 3" class="times">0.0s</p>
- <p v-if="status == 3&&item.remain_milli_seconds>0">--</p>
- <p v-if="status == 3&&item.remain_milli_seconds<=0">{{item.fee || '0.00' | toFixed1}}</p>
- <p v-if="status == 3&&item.remain_milli_seconds>0">--</p>
- <p v-if="status == 3&&item.remain_milli_seconds<=0" :class="item.fact_profits >= 0?'green':'red'">
- {{item.fact_profits || '0' | toFixedNum}}</p>
- <!-- <p v-if="item.status == 3">{{item.fact_profits || '0' | toFixedNum}}</p> -->
- </li>
- </ul>
- <div v-if="orderList.length == 0" class="tc mt10" data-localize="transaction.nodata">{{texts[lang].norecord}}</div>
- <div v-if="orderList.length>0 && hasmore" class="tc mt10" @click="getmore">{{texts[lang].more}}</div>
- <div v-if="orderList.length>0 && !hasmore" class="tc mt10">{{texts[lang].nomore}}</div>
- </div>
- <div style="height:160px;"></div>
- <!-- 底部 -->
- <div id="bottom" class="flex between">
- <div class="flex bottom-left between" @click="slectedTime()">
- <div class="tc">
- <p data-localize="assets.num">{{texts[lang].num}}</p>
- <p class="ftColor">{{inputValue || '0.00' | toFixedNum}}</p>
- </div>
- <div class="tc">
- <p data-localize="assets.time">{{texts[lang].time}}</p>
- <p class="ftColor">{{seconds || '00'}}s</p>
- </div>
- <div class="tc">
- <p data-localize="contract.profitRate">{{texts[lang].rate}}</p>
- <p class="ftColor">{{profitRatio || '00' | toFixedNum}}%</p>
- </div>
- <div class="logo-down">
- <img src="../../static/image/downs.png" alt="">
- </div>
- </div>
- <div class="flex">
- <button class="second-buy" @click="buyModal(1)" data-localize="contract.buyUp">{{texts[lang].up}}</button>
- <button class="second-sell" @click="buyModal(2)" data-localize="contract.buyAll">{{texts[lang].down}}</button>
- </div>
- </div>
- <!-- <div class="flex between plr20 alcenter plr20 bgHeader fixed w100 pos_l0b0" style="height: 80px;">
- <button class="goTranbuy bgRed flex1 ptb10 mr20 white radius4" @click="goTrade('buy')">{{translatedInfo.buy || '--'}}</button>
- <button class="goTransell bgGreen flex1 ptb10 white radius4" @click="goTrade('sell')">{{translatedInfo.sell || '--'}}</button>
- </div> -->
- </div>
- <div id="sideColumn" class="bgBlackColor">
- <div class="ft20 bold bdbs pl20 texts-lever" data-localize="contract.secondContract">{{translatedInfo.micro}}</div>
- <!-- <div class="flex alcenter between ptb20 plr20 bdbs">
- <div class="ft18 bold" :class="{'blue2':topnow==1}" @click="changeTop(1)">{{texts[lang].all}}</div>
- <div class="ft18 bold" :class="{'blue2':topnow==2}" @click="changeTop(2)">{{texts[lang].main}}</div>
- <div class="ft18 bold" :class="{'blue2':topnow==3}" @click="changeTop(3)">{{texts[lang].lever}}</div>
- </div> -->
- <div class="flex alcenter plr20 bdbs bdbs">
- <div class="ptb10 ft16 bold" :class="{'blue2':isActive==i}" v-for="(item,i) in currencyList" :key="i" @click="changeTab(i,item.name)">
- <div class="mr20">{{item.name}}</div>
- </div>
- </div>
- <ul class="ul">
- <li v-for="item in currencyList[isActive].quotation" :key="item.id" v-if="item.open_microtrade == 1"
- :class="['legal_name flex between',{'bg_active':currency_id==item.currency_id}]"
- @click="selectCurrencys(item.id,item.legal_id,item.currency_id,item.legal_name,item.currency_name,item.plate_id)">
- <strong><span>{{item.currency_name}}/{{item.legal_name}}</span></strong>
- <p class="fontC" :class="{ red: parseFloat(item.change) < 0, gre: parseFloat(item.change) >= 0 || item.change == '' }">
- <span>{{item.now_price}}</span>
- </p>
- </li>
- </ul>
- <!-- <ul class="ul" v-if="topnow==2">
- <li v-for="item in currencyList[isActive].quotation" :key="item.id" v-if="item.is_display == 1&&item.open_lever == 1&&item.plate_id==2"
- :class="['legal_name flex between',{'bg_active':currency_id==item.currency_id}]"
- @click="selectCurrencys(item.id,item.legal_id,item.currency_id,item.legal_name,item.currency_name,item.plate_id)">
- <strong><span>{{item.currency_name}}/{{item.legal_name}}</span></strong>
- <p class="fontC" :class="{ red: parseFloat(item.change) < 0, gre: parseFloat(item.change) >= 0 || item.change == '' }">
- <span>{{item.now_price}}</span>
- </p>
- </li>
- </ul>
- <ul class="ul" v-if="topnow==3">
- <li v-for="item in currencyList[isActive].quotation" :key="item.id" v-if="item.is_display == 1&&item.open_lever == 1&&item.plate_id==3"
- :class="['legal_name flex between',{'bg_active':currency_id==item.currency_id}]"
- @click="selectCurrencys(item.id,item.legal_id,item.currency_id,item.legal_name,item.currency_name,item.plate_id)">
- <strong><span>{{item.currency_name}}/{{item.legal_name}}</span></strong>
- <p class="fontC" :class="{ red: parseFloat(item.change) < 0, gre: parseFloat(item.change) >= 0 || item.change == '' }">
- <span>{{item.now_price}}</span>
- </p>
- </li>
- </ul> -->
- </div>
- <!-- 倒计时下单弹窗 -->
- <div class="time-modal">
- <div class="time-header">
- <div>
- <p class="colorGrey ft12" data-localize="contract.transactionMode">{{texts[lang].pattern}}</p>
- <div class="flex warps currency-list mt10">
- <p :class="[{'active':tradeCurrencyId == item.id}]" v-for="item in tradeCurrency" :key="item.id"
- @click="tradeCurrencyClick(item.id,item.name)">
- {{item.name}}
- </p>
- </div>
- </div>
- </div>
- <div class="time-content mt10">
- <p class="colorGrey ft12" data-localize="contract.openQuantity">{{texts[lang].opennum}}</p>
- <div class="time-num between">
- <ul class="flex warps1">
- <li v-for="item in tradeNUm" :key="item.id" @click="tabNumbers(item.number)">
- <p :class="[{'active':(inputValue-0) == (item.number -0).toFixed(0)}]">{{item.number |toFixedNum}}</p>
- </li>
- </ul>
- <input type="number" data-localize="contract.otherQuantities" placeholder="其他数量" v-model="inputValue">
- </div>
- <div class="time-list">
- <p class="colorGrey ft12" data-localize="deals.optime">{{texts[lang].opentime}}</p>
- <div class="flex warps1 currency-list mt10">
- <p :class="[{'active':seconds == item.seconds}]" v-for="item in timeList" :key="item.id"
- @click="selectTime(item.seconds,item.profit_ratio)">{{item.seconds}}s</p>
- </div>
- </div>
- <!-- <div class="time-list">
- <p class="colorGrey ft12">{{texts[lang].insurance}}</p>
- <div class="flex warps1 currency-list mt10">
- <p :class="[{'active':is_insurance == 0}]" @click="changeInsurance(0)">{{texts[lang].no}}</p>
- <p :class="[{'active':is_insurance == 1}]" @click="changeInsurance(1)">{{texts[lang].yes}}</p>
- </div>
- </div> -->
- <div class="flex between ft14">
- <p><span data-localize="contract.accountBalance">{{texts[lang].balance}}</span>: <span class="green bold">{{balance}} {{tradeCurrencyName}}</span></p>
- <p><span data-localize="contract.profitRate">{{texts[lang].rate}}</span>: <span class="green bold ft20">{{profitRatio | toFixedNum}}%</span></p>
- </div>
- </div>
- </div>
- <!-- 下单之后的弹窗 -->
- <div class="orders">
- <div>
- <div class="mt20 orders-list">
- <p class="mt10">
- <span data-localize="assets.num">{{texts[lang].num}}</span>:
- <span>{{inputValue || '0' |toFixedNum}} {{tradeCurrencyName}}</span>
- </p>
- <p class="mt10">
- <span data-localize="assets.time">{{texts[lang].time}}</span>:
- <span>{{seconds}} S</span>
- </p>
- <p class="mt10">
- <span data-localize="contract.profitRate">{{texts[lang].rate}}</span>:
- <span>{{profitRatio}}%</span>
- </p>
- </div>
- </div>
- </div>
- <div id="mask1" @click="closeLeft"></div>
- </div>
- <script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
- <script src="lib/vue.min.js"></script>
- <script src="lib/jquery.js"></script>
- <script src="lib/layer_mobile/layer.js"></script>
- <script src="javascripts/main.js"></script>
- <script src="javascripts/socket.io.js"></script>
- <script src="tradeview/charting_library/charting_library.min.js"></script>
- <script>
- document.addEventListener('UniAppJSBridgeReady', function() {
- // document.querySelector('.btn-list').addEventListener('click', function(evt) {
- // uni.navigateBack({
- // delta: 1
- // });
- // });
- var vm = new Vue({
- el: '#app',
- data: {
- texts: {
- zh: {
- mairo: '合约对冲',
- contract: '永续合约',
- add: '添加自选',
- all: '全部',
- main: '主流',
- lever: '合约',
- pattern: '交易模式',
- num: '数量',
- time: '时间',
- rate: '盈利率',
- opennum: '开仓数量',
- opentime: '开仓时间',
- insurance: '是否购买保险',
- no: '否',
- yes: '是',
- balance: '账户余额',
- up: '买涨',
- down: '买跌',
- list: '持仓列表',
- record: '订单记录',
- buyprice: '购买价',
- nowprice: '当前价',
- okprice: '成交价',
- estimate: '预计盈亏',
- count: '倒计时',
- handrate: '手续费',
- profit: '盈亏',
- norecord: '暂无记录',
- more: '加载更多',
- nomore: '没有更多了',
- },
- en: {
- mairo: 'contract hedging',
- contract: 'perpetual contract',
- add: 'add optional',
- all: 'all',
- main: 'main',
- lever: 'contract',
- pattern: 'transaction mode',
- num: 'quantity',
- time: 'time',
- rate: 'profit rate',
- opennum: 'open quantity',
- opentime: 'opening time',
- insurance: 'whether to buy insurance',
- no: 'no',
- yes: 'yes',
- balance: 'account balance',
- up: 'buy up',
- down: 'buy down',
- list: 'position list',
- record: 'order record',
- buyprice: 'purchase price',
- nowprice: 'current price',
- okprice: 'closing price',
- estimate: 'estimated profit and loss',
- count: 'count down',
- handrate: 'service charge',
- profit: 'profit and loss',
- norecord: 'no record yet',
- more: 'load more',
- nomore: 'no more',
- },
- hk: {
- mairo: '合約對沖',
- contract: '永續合約',
- add: '添加自選',
- all: '全部',
- main: '主流',
- lever: '合約',
- pattern: '交易模式',
- num: '數量',
- time: '時間',
- rate: '盈利率',
- opennum: '開倉數量',
- opentime: '開倉時間',
- insurance: '是否購買保險',
- no: '否',
- yes: '是',
- balance: '帳戶餘額',
- up: '買漲',
- down: '買跌',
- list: '持倉清單',
- record: '訂單記錄',
- buyprice: '購買價',
- nowprice: '當前價',
- okprice: '成交價',
- estimate: '預計盈虧',
- count: '倒數計時',
- handrate: '手續費',
- profit: '盈虧',
- norecord: '暫無記錄',
- more: '加載更多',
- nomore: '沒有更多了',
- },
- jp: {
- mairo: '契約ヘッジ',
- contract: '永遠契約',
- add: '選択を追加',
- all: '全部',
- main: '主流',
- lever: '契約',
- pattern: '取引モード',
- num: '数量',
- time: '時間',
- rate: '利益率',
- opennum: '開倉数量',
- opentime: '開倉時間',
- insurance: 'は保険を買うかどうか',
- no: 'いいえ',
- yes: 'はい',
- balance: '口座残高',
- up: '買い上げる',
- down: '買いおとす',
- list: '保有リスト',
- record: '注文記録',
- buyprice: '買い入れ価格',
- nowprice: '現在の価格',
- okprice: '出来値',
- estimate: '損益を予想する',
- count: 'カウントダウン',
- handrate: '手数料',
- profit: '利益と損失',
- norecord: '記録がない',
- more: 'もっとロード',
- nomore: 'これ以上ないです',
- },
- kor:{
- mairo:"계약 이 성립 하 다.",
- contract:"무기한 계약",
- add:"선택 추가",
- all:"전부.",
- main:"주류.",
- lever:"계약",
- pattern:"거래 패턴",
- num:"수량.",
- time:"시간.",
- rate:"수익 률",
- opennum:"창 고 를 여 는 수량.",
- opentime:"창 고 를 여 는 시간.",
- insurance:"보험 가입 여부",
- no:"아니.",
- yes:"예.",
- balance:"계좌 잔액",
- up:"값 이 오르다",
- down:"매수 하여 떨어뜨리다",
- list:"창고 보유 리스트",
- record:"주문 기록",
- buyprice:"구입 가격",
- nowprice:"현재 가격",
- okprice:"거래 가",
- estimate:"예상 손익",
- count:"카운트다운",
- handrate:"수수료",
- profit:"손익.",
- norecord:"기록 이 없다",
- more:"더 많이 불 러 오기",
- nomore:"더 없어."
- },
- th:{
- mairo:"สัญญาป้องกันความเสี่ยง",
- contract:"สัญญายั่งยืน",
- add:"เพิ่มทางเลือก",
- all:"จำนวนทั้งหมด",
- main:"กระแสหลัก",
- lever:"สนธิสัญญา",
- pattern:"โหมดการซื้อขาย",
- num:"จำนวนรวม",
- time:"กาละ",
- rate:"อัตรากำไร",
- opennum:"จำนวนตำแหน่งเปิด",
- opentime:"เวลาเปิด",
- insurance:"ว่าจะซื้อประกันภัยหรือไม่",
- no:"เลว",
- yes:"ใช่แล้ว",
- balance:"ดุลบัญชี",
- up:"ซื้อขึ้น",
- down:"ซื้อหรือขาย",
- list:"รายชื่อตำแหน่ง",
- record:"บันทึกการสั่งซื้อ",
- buyprice:"ราคาซื้อ",
- nowprice:"ราคาปัจจุบัน",
- okprice:"มูลค่าการซื้อขาย",
- estimate:"คาดการณ์กำไรและขาดทุน",
- count:"การนับถอยหลัง",
- handrate:"ค่าธรรมเนียม",
- profit:"ขาดทุน",
- norecord:"ไม่มีบันทึก",
- more:"โหลดเพิ่มเติม",
- nomore:"ไม่อีกแล้ว"
- }
- },
- widget: null,
- symbolInfo: null,
- feed: null,
- wsEx: null,
- ws: null,
- lists: [],
- newData: '',
- symbol: '',
- priceScale: 100000,
- histime: '',
- newprice: '0.00',
- updown: '0.00',
- maxprice: '0.00',
- minprice: '0.00',
- dayvom: '0.00',
- currencyList: [],
- couponSelected: '',
- legal_id: '',
- currency_id: '',
- legal_name: '',
- currency_name: '',
- currency_match_id:'',
- hasCollcet: '',
- myid: '',
- // balance: '',
- rates: '',
- // websockUrl: 'wss://www.hsfuture.net/ws', //'ws://74.91.27.98/ws'
- // url: 'http://www.hsfuture.net/',
- // websockUrl: 'http://www.bgobtc.com:2000/',
- websockUrl: _DOMAIN+'/',
- url: _DOMAIN+'/',
- complete: [],
- transwords: {
- zh: {
- high: '高',
- low: '低',
- volume: '24H量',
- num: '数量',
- price: '价格',
- time: '时间',
- buy: '买入',
- sell: '卖出',
- chicang:'持仓列表',
- record:'订单记录',
- num:'数量',
- buyprice:'购买价',
- cjprice:'成交价',
- yuji:'预计盈亏',
- daotime:'倒计时',
- type:'类型',
- yingkui:'盈亏',
- time:'时间',
- nolog:'暂无记录',
- more:'加载更多',
- nomore:'没有更多了',
- ylrate:'盈利率',
- buyup:'买涨',
- buydown:'买跌',
- micro:'期权交易',
- model:'交易模式',
- opennum:'开仓数量',
- opentime:'开仓时间',
- balance:'账户余额',
- num1:'数量:',
- yuqi:'预期收益:',
- circle:'结算周期:',
- nowprice:'当前价',
- ceil:'取消',
- ptime:'请选择开仓时间',
- pnum:'请选择开仓数量',
- success:'下单成功'
- },
- en: {
- high: 'high',
- low: 'low',
- volume: '24H volume',
- num: 'number',
- price: 'price',
- time: 'time',
- buy: 'buy',
- sell: 'sell',
- chicang: 'Position list',
- record: 'Order record',
- Num: 'Quantity',
- buyprice: 'Purchase price',
- cjprice: 'Closing price',
- yuji: 'Estimated profit and loss',
- daotime: 'Countdown',
- type: 'Type',
- yingkui: 'Profit and loss',
- time: 'Time',
- nolog: 'No record yet',
- more: 'Load more',
- nomore: 'No more',
- ylrate: 'Profit rate',
- buyup: 'Buy up',
- buydown: 'Buy down',
- micro: 'Option contract',
- model: 'Transaction mode',
- opennum: 'Open quantity',
- opentime: 'Opening time',
- balance: 'Balance',
- num1: 'Quantity',
- yuqi: 'Earnings',
- circle: 'Settlement',
- nowprice: 'Price',
- ceil: 'Cancel',
- ptime: 'Please select the opening time',
- pnum: 'Please select the opening quantity',
- success: 'Order successfully'
- },
- hk: {
- high: '高',
- low: '低',
- volume: '24H量',
- num: '數量',
- price: '價格',
- time: '時間',
- buy: '買入',
- sell: '賣出',
- chicang:'持倉清單',
- record:'訂單記錄',
- num:'數量',
- buyprice:'購買價',
- cjprice:'成交價',
- yuji:'預計盈虧',
- daotime:'倒數計時',
- type:'類型',
- yingkui:'盈虧',
- time:'時間',
- nolog:'暫無記錄',
- more:'加載更多',
- nomore:'沒有更多了',
- ylrate:'盈利率',
- buyup:'買漲',
- buydown:'買跌',
- micro:'秒合約',
- model:'交易模式',
- opennum:'開倉數量',
- opentime:'開倉時間',
- balance:'帳戶餘額',
- num1:'數量:',
- yuqi:'預期收益:',
- circle:'結算週期:',
- nowprice:'當前價',
- ceil:'取消',
- ptime:'請選擇開倉時間',
- pnum:'請選擇開倉數量',
- success:'下單成功'
- },
- jp: {
- high: '高さ',
- low: '低い',
- volume: '24 h量',
- num: '数',
- price: '価格',
- time: '時間',
- buy: '購入',
- sell: '売却',
- chicang:'持倉リスト',
- record:'注文記録',
- num:'数量',
- buylice:'購買価格',
- cjprice:'成約価格',
- yuji:'損益予想',
- daotime:'カウントダウン',
- yingkui:'損益',
- time:'時間',
- nolog:'は記録がありません',
- more:'より多くのロード',
- nomore:'もっとないです' ,
- ylrate:'収益率',
- buyup:'買上高',
- buydown:'買って転んで、',
- micro:'秒契約',
- model:'取引モード',
- opennum:'開倉数量',
- opentime:'開倉時間',
- balance:'口座残高',
- num1:'数量:',
- yuqi:'予想収益:',
- circele:'決算周期:',
- nowprice:'現在価格',
- ceil:'キャンセル',
- ptime:'開倉時間を選んでください',
- pnum:'開倉数量を選んでください',
- success:'注文成功'
- },
- kor:{
- high:"높다.",
- low:"낮다.",
- volume:"24H 량",
- num:"수량.",
- price:"가격.",
- time:"시간.",
- buy:"매입 하 다.",
- sell:"매출 하 다.",
- chicang:"창고 보유 리스트",
- record:"주문 기록",
- buyprice:"구입 가격",
- cjprice:"거래 가",
- yuji:"예상 손익",
- daotime:"카운트다운",
- type:"유형.",
- yingkui:"손익.",
- nolog:"기록 이 없다",
- more:"더 많이 불 러 오기",
- nomore:"더 없어.",
- ylrate:"수익 률",
- buyup:"값 이 오르다",
- buydown:"매수 하여 떨어뜨리다",
- micro:"옵션 거래",
- model:"거래 패턴",
- opennum:"창 고 를 여 는 수량.",
- opentime:"창 고 를 여 는 시간.",
- balance:"계좌 잔액",
- num1:"수량:",
- yuqi:"예상 수익:",
- circle:"결제 주기:",
- nowprice:"현재 가격",
- ceil:"취소 하 다.",
- ptime:"창 고 를 여 는 시간 을 선택 하 세 요",
- pnum:"창 고 수량 을 선택 하 세 요",
- success:"주문 성공"
- },
- th:{
- high:"โด่ง",
- low:"หดหู่ใจ",
- volume:"ปริมาณ",
- num:"จำนวนรวม",
- price:"ราคา",
- time:"กาละ",
- buy:"ซื้อ",
- sell:"ขาย",
- chicang:"รายชื่อตำแหน่ง",
- record:"บันทึกการสั่งซื้อ",
- buyprice:"ราคาซื้อ",
- cjprice:"มูลค่าการซื้อขาย",
- yuji:"คาดการณ์กำไรและขาดทุน",
- daotime:"การนับถอยหลัง",
- type:"รูปร่างลักษณะ",
- yingkui:"ขาดทุน",
- nolog:"ไม่มีบันทึก",
- more:"โหลดเพิ่มเติม",
- nomore:"ไม่อีกแล้ว",
- ylrate:"อัตรากำไร",
- buyup:"ซื้อขึ้น",
- buydown:"ซื้อหรือขาย",
- micro:"การซื้อขายตัวเลือก",
- model:"โหมดการซื้อขาย",
- opennum:"จำนวนตำแหน่งเปิด",
- opentime:"เวลาเปิด",
- balance:"ดุลบัญชี",
- num1:"ปริมาณ",
- yuqi:"รายได้ที่คาดหวัง",
- circle:"วงจรการตั้งถิ่นฐาน",
- nowprice:"ราคาปัจจุบัน",
- ceil:"ยกเลิก",
- ptime:"กรุณาเลือกเวลาเปิด",
- pnum:"กรุณาเลือกหมายเลขการเปิด",
- success:"สั่งซื้อสำเร็จ"
- },
- de:{
- high:"hoch",
- low:"niedrig",
- volume:"24h Volumen",
- num:"Anzahl",
- price:"Preis",
- time:"Zeit",
- buy:"Kauf",
- sell:"Verkauf aus",
- chicang:"Liste der Positionen",
- record:"Aufzeichnungen der Bestellung",
- buyprice:"Der Kaufpreis",
- cjprice:"Preis der Transaktion",
- yuji:"Geschätzte Gewinne und Verluste",
- daotime:"Zählen nach unten",
- type:"Typ",
- yingkui:"Gewinn und Verlust",
- nolog:"Kein Eintrag",
- more:"Laden Sie mehr",
- nomore:"Nicht mehr",
- ylrate:"Verzinsung des Gewinns",
- buyup:"Kaufen Sie auf",
- buydown:"Kaufen Sie unten",
- micro:"Handel mit Optionen",
- model:"Modus der Transaktion",
- opennum:"Menge der Öffnung",
- opentime:"Open Time",
- balance:"Saldo des Kontos",
- num1:"Anzahl:",
- yuqi:"Erwartete Einnahmen:",
- circle:"Zeitraum der Abrechnung:",
- nowprice:"Aktueller Preis",
- ceil:"Stornieren",
- ptime:"Bitte die Öffnungszeiten auswählen",
- pnum:"Bitte wählen Sie die Öffnungsmenge",
- success:"Erfolg der Kasse"
- },
- fra:{
- high:"Élevé",
- low:"Faible",
- volume:"Quantité 24h",
- num:"Nombre",
- price:"Prix",
- time:"Temps",
- buy:"Acheter",
- sell:"Vendre",
- chicang:"Liste des positions",
- record:"Enregistrement des commandes",
- buyprice:"Prix d'achat",
- cjprice:"Prix de transaction",
- yuji:"Résultat escompté",
- daotime:"Compte à rebours",
- type:"Type",
- yingkui:"Profits et pertes",
- nolog:"Pas d'enregistrement pour le moment",
- more:"Charger plus",
- nomore:"Il n'y en a plus.",
- ylrate:"Taux de rentabilité",
- buyup:"Augmentation des achats",
- buydown:"Buy down",
- micro:"Opérations d'options",
- model:"Mode de transaction",
- opennum:"Quantité d'ouverture",
- opentime:"Heure d'ouverture",
- balance:"Solde du compte",
- num1:"Quantité:",
- yuqi:"Avantages escomptés:",
- circle:"Période de règlement:",
- nowprice:"Prix courants",
- ceil:"Annulation",
- ptime:"Veuillez sélectionner l'heure d'ouverture",
- pnum:"Veuillez sélectionner la quantité d'ouverture",
- success:"Commande réussie"
- },
- hi:{
- high:"उच्च",
- low:"कम",
- volume:"24H मात्रा",
- num:"मात्रा",
- price:"कीमत",
- time:"समय",
- buy:"खरीदना",
- sell:"बेचना",
- chicang:"पदों की सूची",
- record:"आदेश रिकॉर्ड",
- buyprice:"खरीद मूल्य",
- cjprice:"अंतिम कीमत",
- yuji:"अनुमानित लाभ और हानि",
- daotime:"उलटी गिनती",
- type:"के प्रकार",
- yingkui:"लाभ और हानि",
- nolog:"कोई रिकॉर्ड नहीं",
- more:"और लोड करें",
- nomore:"अब और नहीं",
- ylrate:"लाभप्रदता",
- buyup:"खरीद लेना",
- buydown:"खरीदना या गिरना",
- micro:"ऑप्शन ट्रेडिंग",
- model:"लेनदेन मोड",
- opennum:"खोले गए पदों की संख्या",
- opentime:"खुलने का समय",
- balance:"खाते में शेष",
- num1:"मात्रा:",
- yuqi:"अपेक्षित आय:",
- circle:"बिलिंग चक्र:",
- nowprice:"मौजूदा कीमत",
- ceil:"रद्द करना",
- ptime:"कृपया खुलने का समय चुनें",
- pnum:"कृपया उद्घाटन की मात्रा चुनें",
- success:"सफलतापूर्वक आदेश दिया गया"
- },
- id:{
- high:"tinggi",
- low:"rendah",
- volume:"Volume 24 jam",
- num:"Kuantitas",
- price:"harga",
- time:"waktu",
- buy:"Membeli di",
- sell:"Menjual",
- chicang:"Daftar posisi",
- record:"Catatan pesanan",
- buyprice:"Harga pembelian",
- cjprice:"harga akhir",
- yuji:"Taksiran untung dan rugi",
- daotime:"Hitung mundur",
- type:"Jenis dari",
- yingkui:"Laba rugi",
- nolog:"Tidak ada catatan",
- more:"Muat lebih banyak",
- nomore:"Tidak lagi",
- ylrate:"Profitabilitas",
- buyup:"Memborong",
- buydown:"Beli atau jatuh",
- micro:"Perdagangan opsi",
- model:"Mode transaksi",
- opennum:"Jumlah posisi dibuka",
- opentime:"Waktu pembukaan",
- balance:"Saldo rekening",
- num1:"Kuantitas:",
- yuqi:"Hasil yang diharapkan:",
- circle:"Siklus penagihan:",
- nowprice:"Harga sekarang",
- ceil:"membatalkan",
- ptime:"Pilih jam buka",
- pnum:"Silakan pilih jumlah pembukaan",
- success:"berhasil dipesan"
- },
- pt:{
- high:"Alto",
- low:"Baixo",
- volume:"24h volume",
- num:"Número",
- price:"Preço",
- time:"Tempo",
- buy:"Compra",
- sell:"Vender fora",
- chicang:"Lista de posições",
- record:"Registos de encomendas",
- buyprice:"Preço de compra",
- cjprice:"Preço de transacção",
- yuji:"Lucros e Perdas estimados",
- daotime:"Contagem decrescente",
- type:"Tipo",
- yingkui:"Resultado e perda",
- nolog:"Sem Registro",
- more:"Carregar Mais",
- nomore:"Não mais.",
- ylrate:"Taxa de lucro",
- buyup:"Compra aí.",
- buydown:"Comprar para baixo",
- micro:"Opções de negociação",
- model:"Modo de transação",
- opennum:"Quantidade de Abertura",
- opentime:"Tempo Aberto",
- balance:"Balanço de conta",
- num1:"Número:",
- yuqi:"Receitas previstas:",
- circle:"Período de liquidação:",
- nowprice:"Preço actual",
- ceil:"Cancelar",
- ptime:"Por favor, selecione a Hora de Abertura",
- pnum:"Seleccione por favor a quantidade de Abertura",
- success:"SUCESSO do checkout"
- },
- ru:{
- high:"высота",
- low:"низкий",
- volume:"24H количество",
- num:"количество",
- price:"цена",
- time:"время",
- buy:"покупать",
- sell:"продать",
- chicang:"Список владельцев бункера",
- record:"запись заказа",
- buyprice:"покупная цена",
- cjprice:"цена сделки",
- yuji:"ожидаемая прибыльность",
- daotime:"обратный отсчет",
- type:"тип",
- yingkui:"полный убыток",
- nolog:"Пока нет записи",
- more:"Загрузить дополнительно",
- nomore:"Больше нет",
- ylrate:"норма прибыли",
- buyup:"купить",
- buydown:"упасть",
- micro:"опционная сделка",
- model:"режим сделок",
- opennum:"количество вскрытия",
- opentime:"время открытия бункера",
- balance:"сальдо счета",
- num1:"количество",
- yuqi:"Ожидаемые выгоды:",
- circle:"расчетный период:",
- nowprice:"текущая цена",
- ceil:"отмена",
- ptime:"Выберите время начала бункера",
- pnum:"Выберите количество бункера",
- success:"Следующий успех"
- },
- spa:{
- high:"Alto",
- low:"Baja",
- volume:"Cantidad de 24h",
- num:"Cantidad",
- price:"Precio",
- time:"Tiempo",
- buy:"Comprar",
- sell:"Vender",
- chicang:"Lista de posiciones",
- record:"Registro de pedidos",
- buyprice:"Precio de compra",
- cjprice:"Precio de transacción",
- yuji:"Ganancias y pérdidas previstas",
- daotime:"Cuenta atrás",
- type:"Tipo",
- yingkui:"Ganancias y pérdidas",
- nolog:"No hay registro",
- more:"Cargar más",
- nomore:"No más",
- ylrate:"Tasa de ganancia",
- buyup:"Comprar",
- buydown:"Comprar o caer",
- micro:"Comercio de opciones",
- model:"Modo de transacción",
- opennum:"Cantidad de apertura",
- opentime:"Tiempo de apertura",
- balance:"Saldo de la cuenta",
- num1:"Cantidad:",
- yuqi:"Ingresos previstos:",
- circle:"Período de liquidación:",
- nowprice:"Precio actual",
- ceil:"Cancelar",
- ptime:"Por favor, seleccione el tiempo de apertura",
- pnum:"Por favor, seleccione la cantidad de apertura",
- success:"Pedido exitoso"
- }
- },
- translatedInfo: {
- high:'',
- low:'',
- volume:'',
- buy:'',
- sell:''
- },
- lang: '',
- sellType: 'buy',
- multipleList: [],
- CountDown: '',
- balance: '',
- rate: '',
- numbers: '0.00',
- expectedReturn: '0.00',
- guaranteeAmount: '0.00',
- tradeType: '',
- tradeCurrency: [],
- tradeCurrencyId: '',
- tradeCurrencyName: '',
- tradeCurrencyData: [],
- tradeNUm: [],
- timeList: [],
- seconds: '',
- inputValue: '',
- profitRatio: '',
- tradeCurrencyIdTest: '',
- secondsTest: '',
- inputValueTest: '',
- profitRatioTest: '',
- balanceTest: '',
- rateTest: '',
- orderData: {
-
- },
- progress: 100,
- set: null,
- status: 1,
- currencyName: "",
- orderList: [],
- set: null,
- bmbBalance: '',
- sets: null,
- insurancType:[],
- userInsurancId:'',
- page:1,
- hasmore:false,
- plate:'',
- opt: false,
- addid:'',
- isActive:0,
- topnow:1,
- topList:['全部','主流','合约'],
- is_insurance: 0,
- styleColor:'',
- greenColor:'#02C289',
- redColor:'#e86d43'
- },
- filters:{
- fixed4:function(vals){
- var values = iTofixed(vals,4);
- return values;
- },
- toFixeds: function (value) {
- value = Number(value);
- return value.toFixed(2);
- },
- toFixeds1: function (value) {
- value = Number(value);
- return value.toFixed(8);
- },
- toFixed4: function (value, options) {
- value = Number(value);
- return value.toFixed(4);
- },
- toFixedNum: function (value, options) {
- value = Number(value);
- return value.toFixed(0);
- },
- toFixed1: function (value, options) {
- value = Number(value);
- return value.toFixed(1);
- },
- },
- created() {
-
- var paramsed = get_all_params();
- // if(paramsed.symbol){
- // that.symbol = paramsed.symbol;
- // let c_name = paramsed.symbol.split('/')
- // that.legal_name = c_name[1];
- // that.currency_name = c_name[0];
- // that.legal_id = paramsed.legal_id;
- // that.currency_id = paramsed.currency_id;
- // that.currency_match_id = paramsed.currency_match_id;
- // that.plate = paramsed.plate;
- // that.topnow = paramsed.plate || 1;
- // document.title = that.symbol;
- // }
- if(window.plus){
- if (!plus.storage.getItem('token')) {
- uni.navigateTo({
- url: '/pages/mine/login',
- });
- }
- }else{
- if (localStorage.getItem('token') == null || localStorage.getItem('token') == '') {
- uni.navigateTo({
- url: '/pages/mine/login',
- });
- }
- }
- },
- computed: {
- listenState() { //监听交易对
- return this.symbol;
- }
- },
- watch: {
- listenState: function(a, b) { //监听交易对
- if (a != b && b != '') {
- this.widget.setSymbol(a, localStorage.getItem('tim'), function onReadyCallback() {}) //切换币种
- }
- }
- },
- mounted() {
- var that = this;
- if(window.plus){
- plus.navigator.setStatusBarStyle('light');
- that.lang = plus.storage.getItem('locale');
- that.translatedInfo = that.transwords[that.lang];
- that.styleColor = plus.storage.getItem('color');
- if(that.styleColor=='green'){
- that.greenColor='#02C289';
- that.redColor='#e86d43';
- }else{
- that.greenColor='#e86d43';
- that.redColor='#02C289';
- }
- }else{
- // that.lang = JSON.parse(localStorage.getItem('lang')).data;
- that.lang = localStorage.getItem('locale');
- that.styleColor = localStorage.getItem('color');
- if(that.styleColor=='green'){
- that.greenColor='#02C289';
- that.redColor='#e86d43';
- }else{
- that.greenColor='#e86d43';
- that.redColor='#02C289';
- }
- that.translatedInfo = that.transwords[that.lang];
- }
- this.init();
- this.getSecond();
- this.getWallet();
- // this.getMyAdd()
- // this.createWidget();
- },
- destroyed() {
- this.removeWidget();
- },
- beforeDestroy() {
- },
- methods: {
- changeTop(e){
- this.topnow=e;
- },
- changeTab(e,name){
- // this.fiat_convert_cny=this.marketLists[e].fiat_convert_cny-0;
- this.isActive=e;
- this.legal_name = name;
- },
- getrate(){
- let that = this;
- initDataToken({
- url: 'market/get_current',
- type: "post",
- data:{
- base_currency:that.currency_name,
- quote_currency:that.legal_name,
- period:'1day'
- }
- }, function (res) {
- console.log(JSON.stringify(res));
- that.updown = res.change
- that.dayvom = Number(res.vol).toFixed(4)
- that.maxprice = res.high
- that.minprice = res.low
- that.newprice = res.close
-
- })
- },
- // getrate(){
- // let that = this;
- // initDataToken({
- // url: 'market/deal',
- // data:{
- // currency_match_id:that.currency_match_id
- // }
- // }, function (res) {
- // let data = res.quotation;
- // that.updown = data.change
- // that.dayvom = Number(data.volume).toFixed(4)
- // that.maxprice = data.high
- // that.minprice = data.low
- // that.newprice = data.close
- // })
- // },
- // 自选添加删除
- toggle(url){
- var that = this;
- that.opt=!that.opt
- initDataToken({
- url: 'user_match/'+url,
- type: "post",
- data:{id:that.currency_match_id},
- }, function (res) {
- layer_msg(res);
- })
- },
- // 我的自选
- getMyAdd(){
- let that = this;
- initDataToken({
- url: 'user_match/list',
- type: "GET",
- }, function (res) {
- console.log(JSON.stringify(res))
- var list = res.data;
- for(var i=0;i<list.length;i++){
- if(list[i].legal_id == that.legal_id && list[i].currency_id == that.currency_id ){
- that.opt= true
- console.log(1)
- }
- }
- })
- },
- init(){
- let that = this;
- initData({ url: 'currency/quotation_new'}, (res, msg) => {
- that.currencyList=res;
- var data1 = res;
- if(!that.legal_id){
- that.legal_id = res[0].id;
- }
- console.log(that.legal_id)
- for (var i = 0; i < data1.length; i++) {
- if (data1[i].id == that.legal_id) {
- var data2 = data1[i].quotation;
- // that.currencyList = data2;
- let data0 = data2[0];
- console.log(data0)
- // var param = get_all_params();
- // if(!param.symbol){
- that.legal_id = data0.legal_id;
- that.currency_id = data0.currency_id;
- that.legal_name = data0.legal_name;
- that.currency_name = data0.currency_name;
- that.currency_match_id = data0.id;
- that.symbol = data0.currency_name+'/'+data0.legal_name;
- // }
- // that.getrate();
- that.createWidget();
- that.orderList = [];
- that.page = 1;
- that.getList();
- }
- }
- // that.getrate();
- // that.createWidget();
- // that.orderList = [];
- // that.page = 1;
- // that.getList();
- })
- },
- //获取期权交易信息
- getWallet(){
- let that = this;
- initDataToken({
- url: 'microtrade/payable_currencies'
- }, function (res) {
- that.tradeCurrency = res;
- // alert(JSON.stringify(res))
- if (res.length > 0) {
- that.tradeCurrencyId = res[0].id;
- that.tradeCurrencyName = res[0].name;
- that.tradeCurrencyIdTest = res[0].id;
- that.tradeNUm = res[0].micro_numbers;
- // that.balance = res[0].micro_account.balance;
- // that.balanceTest = res[0].micro_account.balance;
- that.balance = res[0].user_wallet.micro_with_insurance;
- that.balanceTest = res[0].user_wallet.micro_with_insurance;
- that.rate = res[0].micro_trade_fee;
- that.rateTest = res[0].micro_trade_fee;
- if (that.tradeNUm.length > 0) {
- that.inputValue = (that.tradeNUm[0].number - 0).toFixed(0);
- console.log(that.inputValue)
- that.inputValueTest = that.tradeNUm[0].number;
- }
- }
- that.$forceUpdate();
- })
- },
-
- //获取开仓时间
- getSecond(){
- let that = this;
- initDataToken({
- url: 'microtrade/seconds'
- }, function (res) {
- that.timeList = res;
- if (res.length > 0) {
- that.seconds = res[0].seconds;
- that.profitRatio = res[0].profit_ratio;
- that.secondsTest = res[0].seconds;
- that.profitRatioTest = res[0].profit_ratio
- }
- })
- },
- //选择交易对
- selectCurrencys(ids, legalId, currencyId, legalName, currencyName,plate_id) {
- console.log(ids, legalId, currencyId, legalName, currencyName,plate_id)
- var that = this;
- that.currency_match_id = ids;
- that.legal_id = legalId;
- that.currency_id = currencyId;
- that.symbol = currencyName + '/' + legalName;
- that.currency_name = currencyName;
- that.legal_name = legalName;
- that.plate = plate_id
- $('#mask1').hide();
- $('#sideColumn').animate({
- left: '-70%'
- }, 100);
- // that.init();
- // this.getrate();
- that.createWidget();
- // that.connects();
- that.getList();
- },
-
- tradeCurrencyClick(num, names) {
- var that = this;
- that.tradeCurrencyId = num;
- that.tradeCurrencyName = names;
- for (var i = 0; i < that.tradeCurrency.length; i++) {
- if (that.tradeCurrency[i].id == num) {
- that.tradeNUm = that.tradeCurrency[i].micro_numbers;
- if (that.tradeCurrency[i].user_wallet) {
- if(that.is_insurance==0){
- that.balance = that.tradeCurrency[i].user_wallet.micro_balance;
- }else{
- that.balance = that.tradeCurrency[i].user_wallet.insurance_balance;
- }
- }
- that.rate = that.tradeCurrency[i].micro_trade_fee;
- if (that.tradeNUm.length > 0) {
- that.inputValue = (that.tradeNUm[0].number - 0).toFixed(0);
- }
- }
- }
- },
- changeInsurance(types){
- var that = this;
- that.is_insurance= types;
- for (var i = 0; i < that.tradeCurrency.length; i++) {
- if (that.tradeCurrency[i].id == that.tradeCurrencyId) {
- if (that.tradeCurrency[i].user_wallet) {
- if(that.is_insurance==0){
- that.balance = that.tradeCurrency[i].user_wallet.micro_balance;
- }else{
- that.balance = that.tradeCurrency[i].user_wallet.insurance_balance;
- }
- }
- }
- }
- },
- tabNumbers(num) {
- var that = this;
- that.inputValue = (num - 0).toFixed(0);
- },
- // 买入/卖出按钮点击
- buyModal(types) {
- var that = this;
- that.progress = 100;
- layer.closeAll();
- clearInterval(that.set);
- that.tradeType = types;
- var text1 = '';
- var skin = 'confirm-modal btn-text ';
- if (types == 1) {
- text1 = that.translatedInfo.buyup + that.currencyName;
- skin = 'confirm-modal btn-text buys';
- } else {
- text1 = that.translatedInfo.buydown + that.currencyName;
- skin = 'confirm-modal btn-text sells';
- }
- layer.open({
- type: 1,
- title: text1,
- area: ['90%', 'auto'],
- skin: skin,
- content: $('.orders'),
- shadeClose: true,
- btn: [that.translatedInfo.ceil, text1],
- btn2: function (index) {
- that.taderSubmit()
- },
- success: function () {
-
- }
- })
- },
- slectedTime() {
- var that = this;
- that.progress = 100;
- layer.closeAll();
- clearInterval(that.set);
- layer.open({
- type: 1,
- title: false,
- area: ['100%', 'auto'],
- skin: 'confirm-modal btn-text second-modal',
- content: $('.time-modal'),
- shadeClose: true,
- fixed: true,
- offset: 'b',
- closeBtn: 0,
- // scrollbar: false,
- tipsMore: true,
- btn: [that.translatedInfo.buyup, that.translatedInfo.buydown],
- btn2: function (index) {
- that.buyModal(2);
- },
- yes: function () {
- that.buyModal(1)
- }
- })
- },
- // 下单
- taderSubmit() {
- var that = this;
- if (!that.seconds) {
- layer_msg(that.translatedInfo.ptime);
- return false;
- }
- if (!that.inputValue) {
- layer_msg(that.translatedInfo.pnum);
- return false;
- }
- // else if (that.inputValue % 10 != 0) {
- // layer_msg(getlg('multipleTen'));
- // return false;
- // }
- initDataToken({
- url: 'microtrade/submit',
- data: {
- match_id: that.currency_match_id,
- currency_id: that.tradeCurrencyId,
- type: that.tradeType,
- seconds: that.seconds,
- number: that.inputValue,
- // is_insurance:that.is_insurance
- },
-
- type: 'post'
- }, function (res) {
- layer_msg(that.translatedInfo.success);
- initDataToken({
- url: 'microtrade/payable_currencies'
- }, function (res) {
- if (res.length > 0) {
- for (var i = 0; i < res.length; i++) {
- if (res[i].id == that.tradeCurrencyId) {
- if(that.is_insurance==0){
- that.balance = res[i].user_wallet.micro_balance
- }else{
- that.balance = res[i].user_wallet.insurance_balance;
- }
- }
- }
- }
- })
- // location.reload();
- that.page = 1;
- that.orderList = [];
- clearTimeout(that.set);
- clearInterval(that.sets);
- that.getList();
- })
- },
- selectTime(num, num1) {
- console.log(num1)
- var that = this;
- that.seconds = num;
- // that.profitRatio = Number(num1)*100;
- that.profitRatio = Number(num1);
- },
- // 显示左侧
- showLeft() {
- var that = this;
- $('#mask1').show();
- $('#sideColumn').animate({
- left: '0'
- }, 100);
- },
- // 关闭左侧
- closeLeft() {
- var that = this;
- $('#mask1').hide();
- $('#sideColumn').animate({
- left: '-70%'
- }, 100);
- },
- // 获取期权交易订单列表
- getList() {
- var that = this;
- // that.orderList = [];
- var arr = [];
- clearTimeout(that.set);
- clearInterval(that.sets);
- initDataToken({
- url: 'microtrade/lists',
- data: {
- page: that.page,
- status: that.status,
- limit:10,
- match_id: that.currency_match_id
- }
- }, function (res) {
- that.hasmore = res.current_page<res.last_page ? true : false;
- arr = res.data;
- if(that.page==1){
- that.orderList=[];
- }else{
- arr = that.orderList.concat(arr);
- }
- if (arr.length > 0) {
- var nowTime = new Date().getTime();
- for (var i = 0; i < arr.length; i++) {
- arr[i].endTime = (nowTime - 0) + (arr[i].remain_milli_seconds - 0);
- }
- that.orderList = arr;
- that.Djs_time();
- that.set = setTimeout(that.countDown, 200);
- }
- })
- },
- getmore(){
- this.page++;
- this.getList();
- },
- // 订单倒计时
- countDown(val, indexs, seconds, relSeconds) {
- var that = this;
- var timeValue = '';
- // var process = 100 / Number(seconds);
- var endItem = val; //获取列表传的截止时间
- var nowItem = new Date().getTime(); //获取当前时间
- var timeSpace = endItem - nowItem; //截止时间减去当前时间
- var seconds = '';
- if (timeSpace > 0) {
- seconds = (timeSpace / 1000).toFixed(1);
- console.log(seconds)
- return seconds;
- } else if (timeSpace <= 0) {
- return 0.0;
- // 倒计时结束打开
- // clearTimeout(that.set);
- // var arr = that.orderList;
- // arr.splice(indexs,1)
- // that.orderList = arr;
- // console.log(that.orderList.splice(indexs,1))
- // that.orderList = that.orderList.splice(indexs,1);
- // that.getList();
- // 或者刷新页面
- // location.reload();
- }
- },
- Djs_time: function () {
- this.sets = setInterval(() => {
- var presentTime = new Date().getTime();
- this.CountDown = presentTime
- }, 200);
- },
- // 选择期权交易订单类型
- selectOrder(types) {
- var that = this;
- that.status = types;
- that.page = 1;
- that.orderList = [];
- that.getList();
- },
- goback() {
- if(window.plus){
- uni.navigateBack({
- delta: 1
- });
- }else{
- history.back(-1);
- }
- },
- golever(){
- var data = {
- legalId: this.legal_id,
- currencyId: this.currency_id,
- plateId: this.plate
- };
- if(window.plus){
- plus.storage.setItem('leverOrder', JSON.stringify(data));
- }else{
- localStorage.setItem('leverOrder', JSON.stringify(data));
- }
-
- uni.switchTab({
- url: '/pages/lever/lever'
- })
- },
- // goTrade(mytype) {
- // let localData = {
- // legal_name: this.legal_name,
- // legal_id: this.legal_id,
- // currency_name: this.currency_name,
- // currency_id: this.currency_id,
- // match_id:this.currency_match_id
- // }
-
- // if(window.plus){
- // plus.storage.setItem('tradeData', JSON.stringify(localData));
- // plus.storage.setItem('tradeType', mytype);
- // }else{
- // localStorage.setItem('tradeData', JSON.stringify(localData));
- // localStorage.setItem('tradeType', mytype);
- // }
- // uni.switchTab({
- // url: '/pages/trade/trade'
- // })
- // },
- timestampToTime(timestamp) {
- var time=''
- if(timestamp.toString().length>11){
- time=timestamp
- }else{
- time=timestamp*1000
- }
- var now = new Date(time),
- y = now.getFullYear(),
- m = now.getMonth() + 1,
- d = now.getDate();
- return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
- },
- // 默认
- connect(real) { //封装推送数据
- var that = this,tokens='';
- if(window.plus){
- if (plus.storage.getItem('uid')) {
- tokens=JSON.parse(plus.storage.getItem('uid')).data
- }
- }else{
- if(localStorage.getItem('uid')){
- tokens = JSON.parse(localStorage.getItem('uid')).data;
- }
- }
- var socket=io(socket_api);
- socket.emit('login',tokens);
- socket.on('kline', msg=>{
- if (msg.type == 'kline') {
- let obj = {};
- var types = localStorage.getItem('type');
- if (that.symbol == msg.symbol) {
- let data = msg;
- if (data.period == types) {
- obj.open = Number(data.open)
- obj.low = Number(data.low)
- obj.high = Number(data.high)
- obj.close = Number(data.close)
- obj.volume = Number(data.volume)
- obj.time = Number(data.time)
- real(obj)
- }
- }
- }
- });
-
- socket.on('daymarket', msg=> {
- if (msg.type == 'daymarket') {
- if (that.symbol == msg.symbol) {
- let datas = msg;
- that.newprice = datas.close;
- that.maxprice = datas.high;
- that.minprice = datas.low;
- that.dayvom = Number(datas.volume).toFixed(4);
- that.updown = datas.change;
- }
- }
- });
- socket.on('closed_microorder', msg=> {
- if (msg.type == 'closed_microorder') {
- for (var i = 0; i < that.orderList.length; i++) {
- if (that.orderList[i].id == datas.id) {
- that.orderList[i] = datas;
- setTimeout( ()=> {
- var arr = that.orderList;
- arr.splice(i, 1)
- that.orderList = arr;
- }, 500)
- return false;
- }
- }
- }
- });
- },
- createWidget() {
- let _this = this;
- this.$nextTick(()=> {
- let widget = _this.widget = new TradingView.widget({
- symbol: _this.symbol,
- interval: 1,
- debug: true,
- fullscreen: false,
- autosize: true,
- container_id: "tv_chart_container",
- // datafeed: new Datafeeds.UDFCompatibleDatafeed("http://demo_feed.tradingview.com"),
- datafeed: _this.createFeed(),
- library_path: "tradeview/charting_library/",
- custom_css_url: 'bundles/new.css',
- locale: _this.lang,
- width: "100%",
- height: 516,
- drawings_access: {
- type: 'black',
- tools: [{
- name: "Regression Trend"
- }]
- },
- disabled_features: [ // 禁用的功能
- 'left_toolbar', 'widget_logo', 'header_saveload', 'compare_symbol', 'display_market_status',
- 'go_to_date', 'header_chart_type', 'header_compare', 'header_interval_dialog_button',
- 'header_resolutions', 'header_screenshot', 'header_symbol_search', 'header_undo_redo',
- 'legend_context_menu', 'show_hide_button_in_legend', 'show_interval_dialog_on_key_press',
- 'snapshot_trading_drawings', 'symbol_info', 'timeframes_toolbar', 'use_localstorage_for_settings',
- 'volume_force_overlay'
- ],
- enabled_features: [ // 启用的功能(备注:disable_resolution_rebuild 功能用于控制当时间范围为1个月时,日期刻度是否都是每个月1号
- 'dont_show_boolean_study_arguments', 'hide_last_na_study_output', 'move_logo_to_main_pane',
- 'same_data_requery', 'side_toolbar_in_fullscreen_mode', 'disable_resolution_rebuild'
- ],
- charts_storage_url: 'http://saveload.tradingview.com',
- charts_storage_api_version: "1.1",
- toolbar_bg: "transparent",
- timezone: "Asia/Shanghai",
- studies_overrides: {
- "volume.volume.color.0": this.redColor,
- "volume.volume.color.1": this.greenColor,
- 'volume.precision': '1000'
- },
- overrides: _this.overrides()
- });
- widget.MAStudies = [];
- widget.selectedIntervalButton = null;
- // widget.setLanguage('en')
- widget.onChartReady(function() { //图表方法
- // document.getElementById('trade-view').childNodes[0].setAttribute('style', 'display:block;width:100%;height:100%;');
- //let that =this
- widget.chart().createStudy('Moving Average', false, true, [15, 'close', 0], null, {
- 'Plot.color': '#e843da'
- });
- widget.chart().createStudy("MA Cross", false, false, [10, 20]);
- let buttonArr = [{
- value: "1min",
- period: "1",
- text: "Time",
- chartType: 3,
- type: "1min"
- },
- {
- value: "1",
- period: "1m",
- text: "1min",
- chartType: 1,
- type: "1min"
- },
- {
- value: "5",
- period: "5m",
- text: "5min",
- chartType: 1,
- type: "5min"
- },
- {
- value: "30",
- period: "30m",
- text: "30min",
- chartType: 1,
- type: "30min"
- },
- {
- value: "60",
- period: "60分钟",
- text: "1hour",
- chartType: 1,
- type: "60min"
- },
- {
- value: "1D",
- period: "1D",
- text: "1day",
- chartType: 1,
- type: "1day"
- },
- {
- value: "1W",
- period: "1W",
- text: "1week",
- chartType: 1,
- type: "1week"
- },
- {
- value: "1M",
- period: "1M",
- text: "1mon",
- chartType: 1,
- type: "1mon"
- }
- ];
- let btn = {};
- let nowTime = '';
- buttonArr.forEach((v, i) => {
- let button = widget.createButton()
- button.attr('title', v.text)
- .addClass("my2")
- .text(v.text)
- if (v.text == '1min') {
- button.css({
- 'color': '#218bde',
- 'border-bottom': '1px solid #218bde'
- })
- localStorage.setItem('tim', '1min') //默认为1分钟
- localStorage.setItem('type', '1min') //默认为1分钟
- }
- btn = button.on("click", function(e) {
- $(this).parents(".left").children().find(".my2").removeAttr("style"); //去掉1分钟的
- handleClick(e, v.value, v.type);
- widget.chart().setChartType(v.chartType); //改变K线类型
- });
- });
- if (localStorage.getItem('tim') == '1min') {
- widget.chart().setChartType(1);
- }
- let handleClick = (e, value, type) => {
- _this.setSymbol = function(symbol, value) {
- gh.chart().setSymbol(symbol, value);
- };
- localStorage.setItem('tim', value);
- localStorage.setItem('type', type) //默认为1分钟
- widget.chart().setResolution(value, function onReadyCallback() {}); //改变分辨率
- $(e.target)
- .addClass("mydate")
- .closest("div.space-single")
- .siblings("div.space-single")
- .find("div.button")
- .removeClass("mydate")
- };
- });
- _this.widget = widget;
- })
- },
- createFeed() {
- let this_vue = this;
- let Datafeed = {};
- Datafeed.DataPulseUpdater = function(datafeed, updateFrequency) {
- this._datafeed = datafeed;
- this._subscribers = {};
- this._requestsPending = 0;
- var that = this;
- var update = function() {
- if (that._requestsPending > 0) {
- return;
- }
- for (var listenerGUID in that._subscribers) {
- var subscriptionRecord = that._subscribers[listenerGUID];
- var resolution = subscriptionRecord.resolution;
- var datesRangeRight = parseInt((new Date().valueOf()) / 1000);
- // BEWARE: please note we really need 2 bars, not the only last one
- // see the explanation below. `10` is the `large enough` value to work around holidays
- var datesRangeLeft = datesRangeRight - that.periodLengthSeconds(resolution, 10);
- that._requestsPending++;
- (function(_subscriptionRecord) { // eslint-disable-line
- that._datafeed.getBars(_subscriptionRecord.symbolInfo, resolution, datesRangeLeft, datesRangeRight,
- function(bars) {
- that._requestsPending--;
- // means the subscription was cancelled while waiting for data
- if (!that._subscribers.hasOwnProperty(listenerGUID)) {
- return;
- }
- if (bars.length === 0) {
- return;
- }
- var lastBar = bars[bars.length - 1];
- if (!isNaN(_subscriptionRecord.lastBarTime) && lastBar.time < _subscriptionRecord.lastBarTime) {
- return;
- }
- var subscribers = _subscriptionRecord.listeners;
- // BEWARE: this one isn't working when first update comes and this update makes a new bar. In this case
- // _subscriptionRecord.lastBarTime = NaN
- var isNewBar = !isNaN(_subscriptionRecord.lastBarTime) && lastBar.time > _subscriptionRecord.lastBarTime;
- // Pulse updating may miss some trades data (ie, if pulse period = 10 secods and new bar is started 5 seconds later after the last update, the
- // old bar's last 5 seconds trades will be lost). Thus, at fist we should broadcast old bar updates when it's ready.
- if (isNewBar) {
- if (bars.length < 2) {
- throw new Error('Not enough bars in history for proper pulse update. Need at least 2.');
- }
- var previousBar = bars[bars.length - 2];
- for (var i = 0; i < subscribers.length; ++i) {
- subscribers[i](previousBar);
- }
- }
- _subscriptionRecord.lastBarTime = lastBar.time;
- for (var i = 0; i < subscribers.length; ++i) {
- subscribers[i](lastBar);
- }
- },
- // on error
- function() {
- that._requestsPending--;
- });
- })(subscriptionRecord);
- }
- };
- if (typeof updateFrequency != 'undefined' && updateFrequency > 0) {
- setInterval(update, updateFrequency);
- }
- };
- Datafeed.DataPulseUpdater.prototype.periodLengthSeconds = function(resolution, requiredPeriodsCount) {
- var daysCount = 0;
- if (resolution === 'D') {
- daysCount = requiredPeriodsCount;
- } else if (resolution === 'M') {
- daysCount = 31 * requiredPeriodsCount;
- } else if (resolution === 'W') {
- daysCount = 7 * requiredPeriodsCount;
- } else {
- daysCount = requiredPeriodsCount * resolution / (24 * 60);
- }
- return daysCount * 24 * 60 * 60;
- };
- Datafeed.DataPulseUpdater.prototype.subscribeDataListener = function(symbolInfo, resolution, newDataCallback,
- listenerGUID) {
- this._datafeed._logMessage('Subscribing ' + listenerGUID);
- if (!this._subscribers.hasOwnProperty(listenerGUID)) {
- this._subscribers[listenerGUID] = {
- symbolInfo: symbolInfo,
- resolution: resolution,
- lastBarTime: NaN,
- listeners: []
- };
- }
- this._subscribers[listenerGUID].listeners.push(newDataCallback);
- };
- Datafeed.DataPulseUpdater.prototype.unsubscribeDataListener = function(listenerGUID) {
- this._datafeed._logMessage('Unsubscribing ' + listenerGUID);
- delete this._subscribers[listenerGUID];
- };
- Datafeed.Container = function(updateFrequency) {
- this._configuration = {
- supports_search: false,
- supports_group_request: false,
- supported_resolutions: ['1', '3', '5', '15', '30', '60', '120', '240', '360', '720', '1D', '3D', '1W',
- '1M'
- ],
- supports_marks: true,
- supports_timescale_marks: true,
- exchanges: ['gh']
- };
- this._barsPulseUpdater = new Datafeed.DataPulseUpdater(this, updateFrequency || 10 * 1000);
- // this._quotesPulseUpdater = new Datafeed.QuotesPulseUpdater(this);
- this._enableLogging = true;
- this._callbacks = {};
- this._initializationFinished = true;
- this._fireEvent('initialized');
- this._fireEvent('configuration_ready');
- };
- Datafeed.Container.prototype._fireEvent = function(event, argument) {
- if (this._callbacks.hasOwnProperty(event)) {
- var callbacksChain = this._callbacks[event];
- for (var i = 0; i < callbacksChain.length; ++i) {
- callbacksChain[i](argument);
- }
- this._callbacks[event] = [];
- }
- };
- Datafeed.Container.prototype._logMessage = function(message) {
- if (this._enableLogging) {
- var now = new Date();
- }
- };
- Datafeed.Container.prototype.on = function(event, callback) {
- if (!this._callbacks.hasOwnProperty(event)) {
- this._callbacks[event] = [];
- }
- this._callbacks[event].push(callback);
- return this;
- };
- Datafeed.Container.prototype.onReady = function(callback) {
- let that = this;
- if (this._configuration) {
- setTimeout(function() {
- callback(that._configuration);
- }, 0);
- } else {
- this.on('configuration_ready', function() {
- callback(that._configuration);
- });
- }
- };
- Datafeed.Container.prototype.resolveSymbol = function(symbolName, onSymbolResolvedCallback,
- onResolveErrorCallback) {
- this._logMessage("GOWNO :: resolve symbol " + symbolName);
- Promise.resolve().then(() => {
- // this._logMessage("GOWNO :: onResultReady inject "+'AAPL');
- onSymbolResolvedCallback({
- "name": this_vue.symbol,
- "timezone": "Asia/Shanghai",
- "pricescale": this_vue.priceScale,
- "minmov": 1, //minmov(最小波动), pricescale(价格精度), minmove2, fractional(分数)
- "minmov2": 0, //这是一个神奇的数字来格式化复杂情况下的价格。
- "ticker": this_vue.symbol,
- "description": "",
- "type": "bitcoin",
- "volume_precision": 8,
- // "exchange-traded": "sdt",
- // "exchange-listed": "sdt",
- //现在,这两个字段都为某个交易所的略称。将被显示在图表的图例中,以表示此商品。目前此字段不用于其他目的。
- "has_intraday": true,
- "has_weekly_and_monthly": true,
- "has_no_volume": false, //布尔表示商品是否拥有成交量数据。
- 'session': '24x7',
- 'supported_resolutions': ['1', '3', '5', '15', '30', '60', '120', '240', '360', '720', '1D', '3D',
- '1W',
- '1M'
- ]
- });
- })
- };
- //初始化数据
- Datafeed.Container.prototype.getBars = function(symbolInfo, resolution, rangeStartDate, rangeEndDate,
- onHistoryCallback, onErrorCallback) {
- // if (rangeStartDate > 0 && (rangeStartDate + '').length > 10) {
- // throw new Error(['Got a JS time instead of Unix one.', rangeStartDate, rangeEndDate]);
- // }
- if (resolution.indexOf('D') == -1 && resolution.indexOf('W') == -1 && resolution.indexOf('M') == -1) {
- resolution = resolution + 'min'
- } else if (resolution.indexOf('W') != -1 || resolution.indexOf('M') != -1) {
- resolution = resolution
- }
- // console.log(rangeStartDate);
- // console.log(rangeEndDate)
- // console.log(resolution);
- // console.log(JSON.stringify(symbolInfo) )
- $.ajax({
- url: this_vue.url + 'api/currency/new_timeshar?' + 'from=' + rangeStartDate + '&to=' + rangeEndDate +
- '&symbol=' + symbolInfo.name + '&period=' + resolution,
- type: 'get',
- success: function(res) {
- // console.log(res.data)
- // console.log(JSON.stringify(res))
- if (res.code == 1 && res.data && res.data.length > 0) {
- res.data.forEach((item, i) => {
- item.open = Number(item.open)
- item.close = Number(item.close)
- item.high = Number(item.high)
- item.low = Number(item.low)
- // if(len==i){
- // console.log(i)
- // this_vue.newprice = item.close - 0
- // this_vue.maxprice = item.high - 0
- // this_vue.minprice = item.low - 0
- // this_vue.dayvom = Number(item.vol).toFixed(2);
- // this_vue.updown = ((item.close - item.open) / (item.open - 0) * 100).toFixed(4).toString();
- // }
- })
- onHistoryCallback(res.data, {
- noData: false
- })
- onHistoryCallback([], {
- noData: true
- })
- }
- if (!res.data || res.code == -1) {
- onHistoryCallback([], {
- noData: true
- })
- }
- if (res.data && res.data.length == 0) {
- onHistoryCallback([], {
- noData: true
- })
- }
- }
- })
- };
- //实时数据
- Datafeed.Container.prototype.subscribeBars = function(symbolInfo, resolution, onRealtimeCallback,
- listenerGUID,
- onResetCacheNeededCallback) {
- this_vue.connect(onRealtimeCallback)
- //this._barsPulseUpdater.subscribeDataListener(symbolInfo, resolution, onRealtimeCallback, listenerGUID, onResetCacheNeededCallback);
- };
- Datafeed.Container.prototype.unsubscribeBars = function(listenerGUID) {
- this._barsPulseUpdater.unsubscribeDataListener(listenerGUID);
- };
- return new Datafeed.Container;
- },
- updateWidget(item) {
- this.symbolInfo = {
- name: item,
- ticker: item,
- description: "",
- session: "24x7",
- supported_resolutions: ['1', '5', '30', '60', '240', '1D', '3D', '1W', '1M'],
- has_intraday: true,
- has_daily: true,
- has_weekly_and_monthly: true,
- timezone: "UTC",
- }
- this.removeWidget();
- this.createWidget();
- },
- removeWidget() {
- if (this.widget) {
- this.widget.remove();
- this.widget = null;
- }
- },
- overrides() {
- let style = {
- up: this.greenColor,
- down: this.redColor,
- bg: "#131f30",
- grid: "#1E2740",
- cross: "#1E2740",
- border: "#4e5b85",
- text: "#61688A",
- areatop: "rgba(122, 152, 247, .1)",
- areadown: "rgba(122, 152, 247, .02)"
- };
- return {
- 'volumePaneSize': "small", //large, medium, small, tiny
- 'paneProperties.topMargin': '20',
- "scalesProperties.lineColor": style.bg,
- "scalesProperties.textColor": style.text,
- "paneProperties.background": style.bg, //改变背景色的重要代码
- "paneProperties.vertGridProperties.color": style.grid,
- "paneProperties.horzGridProperties.color": style.grid,
- "paneProperties.crossHairProperties.color": style.cross,
- "paneProperties.legendProperties.showLegend": true,
- "paneProperties.legendProperties.showStudyArguments": true,
- "paneProperties.legendProperties.showStudyTitles": true,
- "paneProperties.legendProperties.showStudyValues": true,
- "paneProperties.legendProperties.showSeriesTitle": true,
- "paneProperties.legendProperties.showSeriesOHLC": true,
- "mainSeriesProperties.candleStyle.upColor": style.up,
- "mainSeriesProperties.candleStyle.downColor": style.down,
- "mainSeriesProperties.candleStyle.drawWick": true,
- "mainSeriesProperties.candleStyle.drawBorder": true,
- "mainSeriesProperties.candleStyle.borderColor": style.border,
- "mainSeriesProperties.candleStyle.borderUpColor": style.up,
- "mainSeriesProperties.candleStyle.borderDownColor": style.down,
- "mainSeriesProperties.candleStyle.wickUpColor": style.up,
- "mainSeriesProperties.candleStyle.wickDownColor": style.down,
- "mainSeriesProperties.candleStyle.barColorsOnPrevClose": false,
- "mainSeriesProperties.hollowCandleStyle.upColor": style.up,
- "mainSeriesProperties.hollowCandleStyle.downColor": style.down,
- "mainSeriesProperties.hollowCandleStyle.drawWick": true,
- "mainSeriesProperties.hollowCandleStyle.drawBorder": true,
- "mainSeriesProperties.hollowCandleStyle.borderColor": style.border,
- "mainSeriesProperties.hollowCandleStyle.borderUpColor": style.up,
- "mainSeriesProperties.hollowCandleStyle.borderDownColor": style.down,
- "mainSeriesProperties.hollowCandleStyle.wickColor": style.line,
- "mainSeriesProperties.haStyle.upColor": style.up,
- "mainSeriesProperties.haStyle.downColor": style.down,
- "mainSeriesProperties.haStyle.drawWick": true,
- "mainSeriesProperties.haStyle.drawBorder": true,
- "mainSeriesProperties.haStyle.borderColor": style.border,
- "mainSeriesProperties.haStyle.borderUpColor": style.up,
- "mainSeriesProperties.haStyle.borderDownColor": style.down,
- "mainSeriesProperties.haStyle.wickColor": style.border,
- "mainSeriesProperties.haStyle.barColorsOnPrevClose": false,
- "mainSeriesProperties.barStyle.upColor": style.up,
- "mainSeriesProperties.barStyle.downColor": style.down,
- "mainSeriesProperties.barStyle.barColorsOnPrevClose": false,
- "mainSeriesProperties.barStyle.dontDrawOpen": false,
- "mainSeriesProperties.lineStyle.color": style.border,
- "mainSeriesProperties.lineStyle.linewidth": 1,
- "mainSeriesProperties.lineStyle.priceSource": "close",
- "mainSeriesProperties.areaStyle.color1": style.areatop,
- "mainSeriesProperties.areaStyle.color2": style.areadown,
- "mainSeriesProperties.areaStyle.linecolor": style.borders,
- "mainSeriesProperties.areaStyle.linewidth": 1,
- "mainSeriesProperties.areaStyle.priceSource": "close"
- }
- },
- chose() {
- this.widget.setLanguage('en') //设置语言
- }
- },
- })
- })
- </script>
- </body>
- </html>
|