second.html 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title> </title>
  8. <link rel="stylesheet" href="css/common.css">
  9. <link rel="stylesheet" href="css/dataMap.css">
  10. </head>
  11. <style>
  12. [v-cloak]{
  13. display: none !important;
  14. }
  15. </style>
  16. <body>
  17. <!-- <div class="h20 bgHeader"></div> -->
  18. <div id="app" v-cloak class="bgBalck">
  19. <div class="header plr15 flex alcenter bgHeader white fixed pt30">
  20. <img src="../../static/image/return.png" class="h15 wt15 mr10" @click="goback" />
  21. <div class="flex alcenter" @click="showLeft">
  22. <img src="../../static/image/lists.png" style="width: 20px;">
  23. <span class="white ft18 bold pl10">{{symbol}}</span>
  24. </div>
  25. </div>
  26. <div>
  27. <div class="pt60 pb10 plr20 bgHeader" style="min-height: 50px;">
  28. <div class="flex alcenter between pt5">
  29. <div class="tc" :class="[updown.substring(0,1) == '-'?'red':'green']">
  30. <p class="bold ft24">{{newprice || '0.00'}}</p>
  31. <p class="mt10">{{updown ||'0.00'}}%</p>
  32. </div>
  33. <div class="w50">
  34. <div class="flex between mb5">
  35. <span class="blue">{{translatedInfo.high || '--'}}</span>
  36. <span class="blue white">{{maxprice || '0.00'}}</span>
  37. </div>
  38. <div class="flex between mb5">
  39. <span class="blue">{{translatedInfo.low || '--'}}</span>
  40. <span class="blue white">{{minprice ||'0.00'}}</span>
  41. </div>
  42. <div class="flex between">
  43. <span class="blue">{{translatedInfo.volume || '--'}}</span>
  44. <span class="blue white">{{dayvom ||'0.00'}}</span>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. <div id="tv_chart_container" style="width:100%;height:60vh;margin-top: 5px;"></div>
  50. <!--订单列表 -->
  51. <div class="order-list">
  52. <div class="flex order-list-header between">
  53. <p class="tc" :class="[{'active':status == 1}]" @click="selectOrder(1)" data-localize="contract.positionList">{{texts[lang].list}}</p>
  54. <p class="tc" :class="[{'active':status == 3}]" @click="selectOrder(3)" data-localize="td.drecord">{{texts[lang].record}}</p>
  55. </div>
  56. <p v-show="false">{{CountDown}}</p>
  57. <ul class="lists">
  58. <li class="flex between ft10">
  59. <p data-localize="assets.num">{{texts[lang].num}}</p>
  60. <p data-localize="contract.purchasePrice">{{texts[lang].buyprice}}</p>
  61. <p v-show="status == 1" data-localize="deals.nowprice">{{texts[lang].nowprice}}</p>
  62. <p v-show="status == 3" data-localize="contract.transactionPrice">{{texts[lang].okprice}}</p>
  63. <p v-show="status == 1" data-localize="contract.estimated">{{texts[lang].estimate}}</p>
  64. <p v-show="status == 1" data-localize="contract.countDown">{{texts[lang].count}}</p>
  65. <p v-show="status == 3" data-localize="deals.fee">{{texts[lang].handrate}}</p>
  66. <p v-show="status == 3" data-localize="contract.profitAndLoss">{{texts[lang].profit}}</p>
  67. </li>
  68. <li
  69. v-if="orderList.length > 0 && item.remain_milli_seconds >0 && status==1 || status ==3 && orderList.length >0"
  70. v-for="(item,index) in orderList" :key="item.id" class="flex between ft10">
  71. <!-- 数量 -->
  72. <!-- <p v-if="item.is_insurance == 1">{{item.number || '0' | toFixedNum}}{{item.currency_name}}{{getlg('just')}}</p>
  73. <p v-else-if="item.is_insurance == 2">{{item.number || '0' | toFixedNum}}{{item.currency_name}}{{getlg('back')}}</p> -->
  74. <p>{{item.number || '0' | toFixedNum}}{{item.currency_name}}</p>
  75. <!-- 购买价 -->
  76. <p>{{item.open_price || '0.00' | toFixed4}}
  77. <img v-if="item.type == 1" width="10" src="./image/buy.png" alt="">
  78. <img v-else width="10" src="./image/sell.png" alt="">
  79. </p>
  80. <!-- 当前价 -->
  81. <p v-if="status == 1&&item.status == 1">{{newprice || '0.00' | toFixed4}}</p>
  82. <!-- 成交价 -->
  83. <p v-if="status == 1&&item.status == 3">{{item.end_price || '0.00' | toFixed4}}</p>
  84. <p v-if="status == 3&&item.remain_milli_seconds>0">--</p>
  85. <p v-if="status == 3&&item.remain_milli_seconds<=0">{{item.end_price || '0.00' | toFixed4}}</p>
  86. <p v-if="status == 1&&item.status == 1 && (item.open_price -0) == (newprice -0)" class="green">0</p>
  87. <p v-if="status == 1&&item.status == 1 && item.type == 1 && (item.open_price -0) > (newprice -0)" class="red">
  88. -{{item.number || '0' | toFixedNum}}</p>
  89. <p v-if="status == 1&&item.status == 1 && item.type == 1 && (item.open_price -0) < (newprice -0)" class="green">
  90. {{(item.number * item.profit_ratio -0) /100 || '0.00' | toFixedNum}}</p>
  91. <p v-if="status == 1&&item.status == 1 && item.type == 2 && (item.open_price -0) > (newprice -0)" class="green">
  92. {{(item.number * item.profit_ratio -0) /100 || '0.00' | toFixedNum}}</p>
  93. <p v-if="status == 1&&item.status == 1 && item.type == 2 && (item.open_price -0) < (newprice -0)" class="red">
  94. -{{(item.number -0) || '0.00' | toFixedNum}}</p>
  95. <p v-if="status == 1&&item.status == 3" :class="item.fact_profits >= 0?'green':'red'">{{item.fact_profits || '0' | toFixedNum}}</p>
  96. <p v-if="status == 1&&item.status == 1" class="times">
  97. {{countDown(item.endTime,index,item.seconds,item.remain_milli_seconds,item.id)}}s</p>
  98. <p v-if="status == 1&&item.status == 3" class="times">0.0s</p>
  99. <p v-if="status == 3&&item.remain_milli_seconds>0">--</p>
  100. <p v-if="status == 3&&item.remain_milli_seconds<=0">{{item.fee || '0.00' | toFixed1}}</p>
  101. <p v-if="status == 3&&item.remain_milli_seconds>0">--</p>
  102. <p v-if="status == 3&&item.remain_milli_seconds<=0" :class="item.fact_profits >= 0?'green':'red'">
  103. {{item.fact_profits || '0' | toFixedNum}}</p>
  104. <!-- <p v-if="item.status == 3">{{item.fact_profits || '0' | toFixedNum}}</p> -->
  105. </li>
  106. </ul>
  107. <div v-if="orderList.length == 0" class="tc mt10" data-localize="transaction.nodata">{{texts[lang].norecord}}</div>
  108. <div v-if="orderList.length>0 && hasmore" class="tc mt10" @click="getmore">{{texts[lang].more}}</div>
  109. <div v-if="orderList.length>0 && !hasmore" class="tc mt10">{{texts[lang].nomore}}</div>
  110. </div>
  111. <div style="height:160px;"></div>
  112. <!-- 底部 -->
  113. <div id="bottom" class="flex between">
  114. <div class="flex bottom-left between" @click="slectedTime()">
  115. <div class="tc">
  116. <p data-localize="assets.num">{{texts[lang].num}}</p>
  117. <p class="ftColor">{{inputValue || '0.00' | toFixedNum}}</p>
  118. </div>
  119. <div class="tc">
  120. <p data-localize="assets.time">{{texts[lang].time}}</p>
  121. <p class="ftColor">{{seconds || '00'}}s</p>
  122. </div>
  123. <div class="tc">
  124. <p data-localize="contract.profitRate">{{texts[lang].rate}}</p>
  125. <p class="ftColor">{{profitRatio || '00' | toFixedNum}}%</p>
  126. </div>
  127. <div class="logo-down">
  128. <img src="../../static/image/downs.png" alt="">
  129. </div>
  130. </div>
  131. <div class="flex">
  132. <button class="second-buy" @click="buyModal(1)" data-localize="contract.buyUp">{{texts[lang].up}}</button>
  133. <button class="second-sell" @click="buyModal(2)" data-localize="contract.buyAll">{{texts[lang].down}}</button>
  134. </div>
  135. </div>
  136. <!-- <div class="flex between plr20 alcenter plr20 bgHeader fixed w100 pos_l0b0" style="height: 80px;">
  137. <button class="goTranbuy bgRed flex1 ptb10 mr20 white radius4" @click="goTrade('buy')">{{translatedInfo.buy || '--'}}</button>
  138. <button class="goTransell bgGreen flex1 ptb10 white radius4" @click="goTrade('sell')">{{translatedInfo.sell || '--'}}</button>
  139. </div> -->
  140. </div>
  141. <div id="sideColumn" class="bgBlackColor">
  142. <div class="ft20 bold bdbs pl20 texts-lever" data-localize="contract.secondContract">{{translatedInfo.micro}}</div>
  143. <!-- <div class="flex alcenter between ptb20 plr20 bdbs">
  144. <div class="ft18 bold" :class="{'blue2':topnow==1}" @click="changeTop(1)">{{texts[lang].all}}</div>
  145. <div class="ft18 bold" :class="{'blue2':topnow==2}" @click="changeTop(2)">{{texts[lang].main}}</div>
  146. <div class="ft18 bold" :class="{'blue2':topnow==3}" @click="changeTop(3)">{{texts[lang].lever}}</div>
  147. </div> -->
  148. <div class="flex alcenter plr20 bdbs bdbs">
  149. <div class="ptb10 ft16 bold" :class="{'blue2':isActive==i}" v-for="(item,i) in currencyList" :key="i" @click="changeTab(i,item.name)">
  150. <div class="mr20">{{item.name}}</div>
  151. </div>
  152. </div>
  153. <ul class="ul">
  154. <li v-for="item in currencyList[isActive].quotation" :key="item.id" v-if="item.open_microtrade == 1"
  155. :class="['legal_name flex between',{'bg_active':currency_id==item.currency_id}]"
  156. @click="selectCurrencys(item.id,item.legal_id,item.currency_id,item.legal_name,item.currency_name,item.plate_id)">
  157. <strong><span>{{item.currency_name}}/{{item.legal_name}}</span></strong>
  158. <p class="fontC" :class="{ red: parseFloat(item.change) < 0, gre: parseFloat(item.change) >= 0 || item.change == '' }">
  159. <span>{{item.now_price}}</span>
  160. </p>
  161. </li>
  162. </ul>
  163. <!-- <ul class="ul" v-if="topnow==2">
  164. <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"
  165. :class="['legal_name flex between',{'bg_active':currency_id==item.currency_id}]"
  166. @click="selectCurrencys(item.id,item.legal_id,item.currency_id,item.legal_name,item.currency_name,item.plate_id)">
  167. <strong><span>{{item.currency_name}}/{{item.legal_name}}</span></strong>
  168. <p class="fontC" :class="{ red: parseFloat(item.change) < 0, gre: parseFloat(item.change) >= 0 || item.change == '' }">
  169. <span>{{item.now_price}}</span>
  170. </p>
  171. </li>
  172. </ul>
  173. <ul class="ul" v-if="topnow==3">
  174. <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"
  175. :class="['legal_name flex between',{'bg_active':currency_id==item.currency_id}]"
  176. @click="selectCurrencys(item.id,item.legal_id,item.currency_id,item.legal_name,item.currency_name,item.plate_id)">
  177. <strong><span>{{item.currency_name}}/{{item.legal_name}}</span></strong>
  178. <p class="fontC" :class="{ red: parseFloat(item.change) < 0, gre: parseFloat(item.change) >= 0 || item.change == '' }">
  179. <span>{{item.now_price}}</span>
  180. </p>
  181. </li>
  182. </ul> -->
  183. </div>
  184. <!-- 倒计时下单弹窗 -->
  185. <div class="time-modal">
  186. <div class="time-header">
  187. <div>
  188. <p class="colorGrey ft12" data-localize="contract.transactionMode">{{texts[lang].pattern}}</p>
  189. <div class="flex warps currency-list mt10">
  190. <p :class="[{'active':tradeCurrencyId == item.id}]" v-for="item in tradeCurrency" :key="item.id"
  191. @click="tradeCurrencyClick(item.id,item.name)">
  192. {{item.name}}
  193. </p>
  194. </div>
  195. </div>
  196. </div>
  197. <div class="time-content mt10">
  198. <p class="colorGrey ft12" data-localize="contract.openQuantity">{{texts[lang].opennum}}</p>
  199. <div class="time-num between">
  200. <ul class="flex warps1">
  201. <li v-for="item in tradeNUm" :key="item.id" @click="tabNumbers(item.number)">
  202. <p :class="[{'active':(inputValue-0) == (item.number -0).toFixed(0)}]">{{item.number |toFixedNum}}</p>
  203. </li>
  204. </ul>
  205. <input type="number" data-localize="contract.otherQuantities" placeholder="其他数量" v-model="inputValue">
  206. </div>
  207. <div class="time-list">
  208. <p class="colorGrey ft12" data-localize="deals.optime">{{texts[lang].opentime}}</p>
  209. <div class="flex warps1 currency-list mt10">
  210. <p :class="[{'active':seconds == item.seconds}]" v-for="item in timeList" :key="item.id"
  211. @click="selectTime(item.seconds,item.profit_ratio)">{{item.seconds}}s</p>
  212. </div>
  213. </div>
  214. <!-- <div class="time-list">
  215. <p class="colorGrey ft12">{{texts[lang].insurance}}</p>
  216. <div class="flex warps1 currency-list mt10">
  217. <p :class="[{'active':is_insurance == 0}]" @click="changeInsurance(0)">{{texts[lang].no}}</p>
  218. <p :class="[{'active':is_insurance == 1}]" @click="changeInsurance(1)">{{texts[lang].yes}}</p>
  219. </div>
  220. </div> -->
  221. <div class="flex between ft14">
  222. <p><span data-localize="contract.accountBalance">{{texts[lang].balance}}</span>: <span class="green bold">{{balance}} {{tradeCurrencyName}}</span></p>
  223. <p><span data-localize="contract.profitRate">{{texts[lang].rate}}</span>: <span class="green bold ft20">{{profitRatio | toFixedNum}}%</span></p>
  224. </div>
  225. </div>
  226. </div>
  227. <!-- 下单之后的弹窗 -->
  228. <div class="orders">
  229. <div>
  230. <div class="mt20 orders-list">
  231. <p class="mt10">
  232. <span data-localize="assets.num">{{texts[lang].num}}</span>:
  233. <span>{{inputValue || '0' |toFixedNum}} {{tradeCurrencyName}}</span>
  234. </p>
  235. <p class="mt10">
  236. <span data-localize="assets.time">{{texts[lang].time}}</span>:
  237. <span>{{seconds}} S</span>
  238. </p>
  239. <p class="mt10">
  240. <span data-localize="contract.profitRate">{{texts[lang].rate}}</span>:
  241. <span>{{profitRatio}}%</span>
  242. </p>
  243. </div>
  244. </div>
  245. </div>
  246. <div id="mask1" @click="closeLeft"></div>
  247. </div>
  248. <script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
  249. <script src="lib/vue.min.js"></script>
  250. <script src="lib/jquery.js"></script>
  251. <script src="lib/layer_mobile/layer.js"></script>
  252. <script src="javascripts/main.js"></script>
  253. <script src="javascripts/socket.io.js"></script>
  254. <script src="tradeview/charting_library/charting_library.min.js"></script>
  255. <script>
  256. document.addEventListener('UniAppJSBridgeReady', function() {
  257. // document.querySelector('.btn-list').addEventListener('click', function(evt) {
  258. // uni.navigateBack({
  259. // delta: 1
  260. // });
  261. // });
  262. var vm = new Vue({
  263. el: '#app',
  264. data: {
  265. texts: {
  266. zh: {
  267. mairo: '合约对冲',
  268. contract: '永续合约',
  269. add: '添加自选',
  270. all: '全部',
  271. main: '主流',
  272. lever: '合约',
  273. pattern: '交易模式',
  274. num: '数量',
  275. time: '时间',
  276. rate: '盈利率',
  277. opennum: '开仓数量',
  278. opentime: '开仓时间',
  279. insurance: '是否购买保险',
  280. no: '否',
  281. yes: '是',
  282. balance: '账户余额',
  283. up: '买涨',
  284. down: '买跌',
  285. list: '持仓列表',
  286. record: '订单记录',
  287. buyprice: '购买价',
  288. nowprice: '当前价',
  289. okprice: '成交价',
  290. estimate: '预计盈亏',
  291. count: '倒计时',
  292. handrate: '手续费',
  293. profit: '盈亏',
  294. norecord: '暂无记录',
  295. more: '加载更多',
  296. nomore: '没有更多了',
  297. },
  298. en: {
  299. mairo: 'contract hedging',
  300. contract: 'perpetual contract',
  301. add: 'add optional',
  302. all: 'all',
  303. main: 'main',
  304. lever: 'contract',
  305. pattern: 'transaction mode',
  306. num: 'quantity',
  307. time: 'time',
  308. rate: 'profit rate',
  309. opennum: 'open quantity',
  310. opentime: 'opening time',
  311. insurance: 'whether to buy insurance',
  312. no: 'no',
  313. yes: 'yes',
  314. balance: 'account balance',
  315. up: 'buy up',
  316. down: 'buy down',
  317. list: 'position list',
  318. record: 'order record',
  319. buyprice: 'purchase price',
  320. nowprice: 'current price',
  321. okprice: 'closing price',
  322. estimate: 'estimated profit and loss',
  323. count: 'count down',
  324. handrate: 'service charge',
  325. profit: 'profit and loss',
  326. norecord: 'no record yet',
  327. more: 'load more',
  328. nomore: 'no more',
  329. },
  330. hk: {
  331. mairo: '合約對沖',
  332. contract: '永續合約',
  333. add: '添加自選',
  334. all: '全部',
  335. main: '主流',
  336. lever: '合約',
  337. pattern: '交易模式',
  338. num: '數量',
  339. time: '時間',
  340. rate: '盈利率',
  341. opennum: '開倉數量',
  342. opentime: '開倉時間',
  343. insurance: '是否購買保險',
  344. no: '否',
  345. yes: '是',
  346. balance: '帳戶餘額',
  347. up: '買漲',
  348. down: '買跌',
  349. list: '持倉清單',
  350. record: '訂單記錄',
  351. buyprice: '購買價',
  352. nowprice: '當前價',
  353. okprice: '成交價',
  354. estimate: '預計盈虧',
  355. count: '倒數計時',
  356. handrate: '手續費',
  357. profit: '盈虧',
  358. norecord: '暫無記錄',
  359. more: '加載更多',
  360. nomore: '沒有更多了',
  361. },
  362. jp: {
  363. mairo: '契約ヘッジ',
  364. contract: '永遠契約',
  365. add: '選択を追加',
  366. all: '全部',
  367. main: '主流',
  368. lever: '契約',
  369. pattern: '取引モード',
  370. num: '数量',
  371. time: '時間',
  372. rate: '利益率',
  373. opennum: '開倉数量',
  374. opentime: '開倉時間',
  375. insurance: 'は保険を買うかどうか',
  376. no: 'いいえ',
  377. yes: 'はい',
  378. balance: '口座残高',
  379. up: '買い上げる',
  380. down: '買いおとす',
  381. list: '保有リスト',
  382. record: '注文記録',
  383. buyprice: '買い入れ価格',
  384. nowprice: '現在の価格',
  385. okprice: '出来値',
  386. estimate: '損益を予想する',
  387. count: 'カウントダウン',
  388. handrate: '手数料',
  389. profit: '利益と損失',
  390. norecord: '記録がない',
  391. more: 'もっとロード',
  392. nomore: 'これ以上ないです',
  393. },
  394. kor:{
  395. mairo:"계약 이 성립 하 다.",
  396. contract:"무기한 계약",
  397. add:"선택 추가",
  398. all:"전부.",
  399. main:"주류.",
  400. lever:"계약",
  401. pattern:"거래 패턴",
  402. num:"수량.",
  403. time:"시간.",
  404. rate:"수익 률",
  405. opennum:"창 고 를 여 는 수량.",
  406. opentime:"창 고 를 여 는 시간.",
  407. insurance:"보험 가입 여부",
  408. no:"아니.",
  409. yes:"예.",
  410. balance:"계좌 잔액",
  411. up:"값 이 오르다",
  412. down:"매수 하여 떨어뜨리다",
  413. list:"창고 보유 리스트",
  414. record:"주문 기록",
  415. buyprice:"구입 가격",
  416. nowprice:"현재 가격",
  417. okprice:"거래 가",
  418. estimate:"예상 손익",
  419. count:"카운트다운",
  420. handrate:"수수료",
  421. profit:"손익.",
  422. norecord:"기록 이 없다",
  423. more:"더 많이 불 러 오기",
  424. nomore:"더 없어."
  425. },
  426. th:{
  427. mairo:"สัญญาป้องกันความเสี่ยง",
  428. contract:"สัญญายั่งยืน",
  429. add:"เพิ่มทางเลือก",
  430. all:"จำนวนทั้งหมด",
  431. main:"กระแสหลัก",
  432. lever:"สนธิสัญญา",
  433. pattern:"โหมดการซื้อขาย",
  434. num:"จำนวนรวม",
  435. time:"กาละ",
  436. rate:"อัตรากำไร",
  437. opennum:"จำนวนตำแหน่งเปิด",
  438. opentime:"เวลาเปิด",
  439. insurance:"ว่าจะซื้อประกันภัยหรือไม่",
  440. no:"เลว",
  441. yes:"ใช่แล้ว",
  442. balance:"ดุลบัญชี",
  443. up:"ซื้อขึ้น",
  444. down:"ซื้อหรือขาย",
  445. list:"รายชื่อตำแหน่ง",
  446. record:"บันทึกการสั่งซื้อ",
  447. buyprice:"ราคาซื้อ",
  448. nowprice:"ราคาปัจจุบัน",
  449. okprice:"มูลค่าการซื้อขาย",
  450. estimate:"คาดการณ์กำไรและขาดทุน",
  451. count:"การนับถอยหลัง",
  452. handrate:"ค่าธรรมเนียม",
  453. profit:"ขาดทุน",
  454. norecord:"ไม่มีบันทึก",
  455. more:"โหลดเพิ่มเติม",
  456. nomore:"ไม่อีกแล้ว"
  457. }
  458. },
  459. widget: null,
  460. symbolInfo: null,
  461. feed: null,
  462. wsEx: null,
  463. ws: null,
  464. lists: [],
  465. newData: '',
  466. symbol: '',
  467. priceScale: 100000,
  468. histime: '',
  469. newprice: '0.00',
  470. updown: '0.00',
  471. maxprice: '0.00',
  472. minprice: '0.00',
  473. dayvom: '0.00',
  474. currencyList: [],
  475. couponSelected: '',
  476. legal_id: '',
  477. currency_id: '',
  478. legal_name: '',
  479. currency_name: '',
  480. currency_match_id:'',
  481. hasCollcet: '',
  482. myid: '',
  483. // balance: '',
  484. rates: '',
  485. // websockUrl: 'wss://www.hsfuture.net/ws', //'ws://74.91.27.98/ws'
  486. // url: 'http://www.hsfuture.net/',
  487. // websockUrl: 'http://www.bgobtc.com:2000/',
  488. websockUrl: _DOMAIN+'/',
  489. url: _DOMAIN+'/',
  490. complete: [],
  491. transwords: {
  492. zh: {
  493. high: '高',
  494. low: '低',
  495. volume: '24H量',
  496. num: '数量',
  497. price: '价格',
  498. time: '时间',
  499. buy: '买入',
  500. sell: '卖出',
  501. chicang:'持仓列表',
  502. record:'订单记录',
  503. num:'数量',
  504. buyprice:'购买价',
  505. cjprice:'成交价',
  506. yuji:'预计盈亏',
  507. daotime:'倒计时',
  508. type:'类型',
  509. yingkui:'盈亏',
  510. time:'时间',
  511. nolog:'暂无记录',
  512. more:'加载更多',
  513. nomore:'没有更多了',
  514. ylrate:'盈利率',
  515. buyup:'买涨',
  516. buydown:'买跌',
  517. micro:'期权交易',
  518. model:'交易模式',
  519. opennum:'开仓数量',
  520. opentime:'开仓时间',
  521. balance:'账户余额',
  522. num1:'数量:',
  523. yuqi:'预期收益:',
  524. circle:'结算周期:',
  525. nowprice:'当前价',
  526. ceil:'取消',
  527. ptime:'请选择开仓时间',
  528. pnum:'请选择开仓数量',
  529. success:'下单成功'
  530. },
  531. en: {
  532. high: 'high',
  533. low: 'low',
  534. volume: '24H volume',
  535. num: 'number',
  536. price: 'price',
  537. time: 'time',
  538. buy: 'buy',
  539. sell: 'sell',
  540. chicang: 'Position list',
  541. record: 'Order record',
  542. Num: 'Quantity',
  543. buyprice: 'Purchase price',
  544. cjprice: 'Closing price',
  545. yuji: 'Estimated profit and loss',
  546. daotime: 'Countdown',
  547. type: 'Type',
  548. yingkui: 'Profit and loss',
  549. time: 'Time',
  550. nolog: 'No record yet',
  551. more: 'Load more',
  552. nomore: 'No more',
  553. ylrate: 'Profit rate',
  554. buyup: 'Buy up',
  555. buydown: 'Buy down',
  556. micro: 'Option contract',
  557. model: 'Transaction mode',
  558. opennum: 'Open quantity',
  559. opentime: 'Opening time',
  560. balance: 'Balance',
  561. num1: 'Quantity',
  562. yuqi: 'Earnings',
  563. circle: 'Settlement',
  564. nowprice: 'Price',
  565. ceil: 'Cancel',
  566. ptime: 'Please select the opening time',
  567. pnum: 'Please select the opening quantity',
  568. success: 'Order successfully'
  569. },
  570. hk: {
  571. high: '高',
  572. low: '低',
  573. volume: '24H量',
  574. num: '數量',
  575. price: '價格',
  576. time: '時間',
  577. buy: '買入',
  578. sell: '賣出',
  579. chicang:'持倉清單',
  580. record:'訂單記錄',
  581. num:'數量',
  582. buyprice:'購買價',
  583. cjprice:'成交價',
  584. yuji:'預計盈虧',
  585. daotime:'倒數計時',
  586. type:'類型',
  587. yingkui:'盈虧',
  588. time:'時間',
  589. nolog:'暫無記錄',
  590. more:'加載更多',
  591. nomore:'沒有更多了',
  592. ylrate:'盈利率',
  593. buyup:'買漲',
  594. buydown:'買跌',
  595. micro:'秒合約',
  596. model:'交易模式',
  597. opennum:'開倉數量',
  598. opentime:'開倉時間',
  599. balance:'帳戶餘額',
  600. num1:'數量:',
  601. yuqi:'預期收益:',
  602. circle:'結算週期:',
  603. nowprice:'當前價',
  604. ceil:'取消',
  605. ptime:'請選擇開倉時間',
  606. pnum:'請選擇開倉數量',
  607. success:'下單成功'
  608. },
  609. jp: {
  610. high: '高さ',
  611. low: '低い',
  612. volume: '24 h量',
  613. num: '数',
  614. price: '価格',
  615. time: '時間',
  616. buy: '購入',
  617. sell: '売却',
  618. chicang:'持倉リスト',
  619. record:'注文記録',
  620. num:'数量',
  621. buylice:'購買価格',
  622. cjprice:'成約価格',
  623. yuji:'損益予想',
  624. daotime:'カウントダウン',
  625. yingkui:'損益',
  626. time:'時間',
  627. nolog:'は記録がありません',
  628. more:'より多くのロード',
  629. nomore:'もっとないです' ,
  630. ylrate:'収益率',
  631. buyup:'買上高',
  632. buydown:'買って転んで、',
  633. micro:'秒契約',
  634. model:'取引モード',
  635. opennum:'開倉数量',
  636. opentime:'開倉時間',
  637. balance:'口座残高',
  638. num1:'数量:',
  639. yuqi:'予想収益:',
  640. circele:'決算周期:',
  641. nowprice:'現在価格',
  642. ceil:'キャンセル',
  643. ptime:'開倉時間を選んでください',
  644. pnum:'開倉数量を選んでください',
  645. success:'注文成功'
  646. },
  647. kor:{
  648. high:"높다.",
  649. low:"낮다.",
  650. volume:"24H 량",
  651. num:"수량.",
  652. price:"가격.",
  653. time:"시간.",
  654. buy:"매입 하 다.",
  655. sell:"매출 하 다.",
  656. chicang:"창고 보유 리스트",
  657. record:"주문 기록",
  658. buyprice:"구입 가격",
  659. cjprice:"거래 가",
  660. yuji:"예상 손익",
  661. daotime:"카운트다운",
  662. type:"유형.",
  663. yingkui:"손익.",
  664. nolog:"기록 이 없다",
  665. more:"더 많이 불 러 오기",
  666. nomore:"더 없어.",
  667. ylrate:"수익 률",
  668. buyup:"값 이 오르다",
  669. buydown:"매수 하여 떨어뜨리다",
  670. micro:"옵션 거래",
  671. model:"거래 패턴",
  672. opennum:"창 고 를 여 는 수량.",
  673. opentime:"창 고 를 여 는 시간.",
  674. balance:"계좌 잔액",
  675. num1:"수량:",
  676. yuqi:"예상 수익:",
  677. circle:"결제 주기:",
  678. nowprice:"현재 가격",
  679. ceil:"취소 하 다.",
  680. ptime:"창 고 를 여 는 시간 을 선택 하 세 요",
  681. pnum:"창 고 수량 을 선택 하 세 요",
  682. success:"주문 성공"
  683. },
  684. th:{
  685. high:"โด่ง",
  686. low:"หดหู่ใจ",
  687. volume:"ปริมาณ",
  688. num:"จำนวนรวม",
  689. price:"ราคา",
  690. time:"กาละ",
  691. buy:"ซื้อ",
  692. sell:"ขาย",
  693. chicang:"รายชื่อตำแหน่ง",
  694. record:"บันทึกการสั่งซื้อ",
  695. buyprice:"ราคาซื้อ",
  696. cjprice:"มูลค่าการซื้อขาย",
  697. yuji:"คาดการณ์กำไรและขาดทุน",
  698. daotime:"การนับถอยหลัง",
  699. type:"รูปร่างลักษณะ",
  700. yingkui:"ขาดทุน",
  701. nolog:"ไม่มีบันทึก",
  702. more:"โหลดเพิ่มเติม",
  703. nomore:"ไม่อีกแล้ว",
  704. ylrate:"อัตรากำไร",
  705. buyup:"ซื้อขึ้น",
  706. buydown:"ซื้อหรือขาย",
  707. micro:"การซื้อขายตัวเลือก",
  708. model:"โหมดการซื้อขาย",
  709. opennum:"จำนวนตำแหน่งเปิด",
  710. opentime:"เวลาเปิด",
  711. balance:"ดุลบัญชี",
  712. num1:"ปริมาณ",
  713. yuqi:"รายได้ที่คาดหวัง",
  714. circle:"วงจรการตั้งถิ่นฐาน",
  715. nowprice:"ราคาปัจจุบัน",
  716. ceil:"ยกเลิก",
  717. ptime:"กรุณาเลือกเวลาเปิด",
  718. pnum:"กรุณาเลือกหมายเลขการเปิด",
  719. success:"สั่งซื้อสำเร็จ"
  720. },
  721. de:{
  722. high:"hoch",
  723. low:"niedrig",
  724. volume:"24h Volumen",
  725. num:"Anzahl",
  726. price:"Preis",
  727. time:"Zeit",
  728. buy:"Kauf",
  729. sell:"Verkauf aus",
  730. chicang:"Liste der Positionen",
  731. record:"Aufzeichnungen der Bestellung",
  732. buyprice:"Der Kaufpreis",
  733. cjprice:"Preis der Transaktion",
  734. yuji:"Geschätzte Gewinne und Verluste",
  735. daotime:"Zählen nach unten",
  736. type:"Typ",
  737. yingkui:"Gewinn und Verlust",
  738. nolog:"Kein Eintrag",
  739. more:"Laden Sie mehr",
  740. nomore:"Nicht mehr",
  741. ylrate:"Verzinsung des Gewinns",
  742. buyup:"Kaufen Sie auf",
  743. buydown:"Kaufen Sie unten",
  744. micro:"Handel mit Optionen",
  745. model:"Modus der Transaktion",
  746. opennum:"Menge der Öffnung",
  747. opentime:"Open Time",
  748. balance:"Saldo des Kontos",
  749. num1:"Anzahl:",
  750. yuqi:"Erwartete Einnahmen:",
  751. circle:"Zeitraum der Abrechnung:",
  752. nowprice:"Aktueller Preis",
  753. ceil:"Stornieren",
  754. ptime:"Bitte die Öffnungszeiten auswählen",
  755. pnum:"Bitte wählen Sie die Öffnungsmenge",
  756. success:"Erfolg der Kasse"
  757. },
  758. fra:{
  759. high:"Élevé",
  760. low:"Faible",
  761. volume:"Quantité 24h",
  762. num:"Nombre",
  763. price:"Prix",
  764. time:"Temps",
  765. buy:"Acheter",
  766. sell:"Vendre",
  767. chicang:"Liste des positions",
  768. record:"Enregistrement des commandes",
  769. buyprice:"Prix d'achat",
  770. cjprice:"Prix de transaction",
  771. yuji:"Résultat escompté",
  772. daotime:"Compte à rebours",
  773. type:"Type",
  774. yingkui:"Profits et pertes",
  775. nolog:"Pas d'enregistrement pour le moment",
  776. more:"Charger plus",
  777. nomore:"Il n'y en a plus.",
  778. ylrate:"Taux de rentabilité",
  779. buyup:"Augmentation des achats",
  780. buydown:"Buy down",
  781. micro:"Opérations d'options",
  782. model:"Mode de transaction",
  783. opennum:"Quantité d'ouverture",
  784. opentime:"Heure d'ouverture",
  785. balance:"Solde du compte",
  786. num1:"Quantité:",
  787. yuqi:"Avantages escomptés:",
  788. circle:"Période de règlement:",
  789. nowprice:"Prix courants",
  790. ceil:"Annulation",
  791. ptime:"Veuillez sélectionner l'heure d'ouverture",
  792. pnum:"Veuillez sélectionner la quantité d'ouverture",
  793. success:"Commande réussie"
  794. },
  795. hi:{
  796. high:"उच्च",
  797. low:"कम",
  798. volume:"24H मात्रा",
  799. num:"मात्रा",
  800. price:"कीमत",
  801. time:"समय",
  802. buy:"खरीदना",
  803. sell:"बेचना",
  804. chicang:"पदों की सूची",
  805. record:"आदेश रिकॉर्ड",
  806. buyprice:"खरीद मूल्य",
  807. cjprice:"अंतिम कीमत",
  808. yuji:"अनुमानित लाभ और हानि",
  809. daotime:"उलटी गिनती",
  810. type:"के प्रकार",
  811. yingkui:"लाभ और हानि",
  812. nolog:"कोई रिकॉर्ड नहीं",
  813. more:"और लोड करें",
  814. nomore:"अब और नहीं",
  815. ylrate:"लाभप्रदता",
  816. buyup:"खरीद लेना",
  817. buydown:"खरीदना या गिरना",
  818. micro:"ऑप्शन ट्रेडिंग",
  819. model:"लेनदेन मोड",
  820. opennum:"खोले गए पदों की संख्या",
  821. opentime:"खुलने का समय",
  822. balance:"खाते में शेष",
  823. num1:"मात्रा:",
  824. yuqi:"अपेक्षित आय:",
  825. circle:"बिलिंग चक्र:",
  826. nowprice:"मौजूदा कीमत",
  827. ceil:"रद्द करना",
  828. ptime:"कृपया खुलने का समय चुनें",
  829. pnum:"कृपया उद्घाटन की मात्रा चुनें",
  830. success:"सफलतापूर्वक आदेश दिया गया"
  831. },
  832. id:{
  833. high:"tinggi",
  834. low:"rendah",
  835. volume:"Volume 24 jam",
  836. num:"Kuantitas",
  837. price:"harga",
  838. time:"waktu",
  839. buy:"Membeli di",
  840. sell:"Menjual",
  841. chicang:"Daftar posisi",
  842. record:"Catatan pesanan",
  843. buyprice:"Harga pembelian",
  844. cjprice:"harga akhir",
  845. yuji:"Taksiran untung dan rugi",
  846. daotime:"Hitung mundur",
  847. type:"Jenis dari",
  848. yingkui:"Laba rugi",
  849. nolog:"Tidak ada catatan",
  850. more:"Muat lebih banyak",
  851. nomore:"Tidak lagi",
  852. ylrate:"Profitabilitas",
  853. buyup:"Memborong",
  854. buydown:"Beli atau jatuh",
  855. micro:"Perdagangan opsi",
  856. model:"Mode transaksi",
  857. opennum:"Jumlah posisi dibuka",
  858. opentime:"Waktu pembukaan",
  859. balance:"Saldo rekening",
  860. num1:"Kuantitas:",
  861. yuqi:"Hasil yang diharapkan:",
  862. circle:"Siklus penagihan:",
  863. nowprice:"Harga sekarang",
  864. ceil:"membatalkan",
  865. ptime:"Pilih jam buka",
  866. pnum:"Silakan pilih jumlah pembukaan",
  867. success:"berhasil dipesan"
  868. },
  869. pt:{
  870. high:"Alto",
  871. low:"Baixo",
  872. volume:"24h volume",
  873. num:"Número",
  874. price:"Preço",
  875. time:"Tempo",
  876. buy:"Compra",
  877. sell:"Vender fora",
  878. chicang:"Lista de posições",
  879. record:"Registos de encomendas",
  880. buyprice:"Preço de compra",
  881. cjprice:"Preço de transacção",
  882. yuji:"Lucros e Perdas estimados",
  883. daotime:"Contagem decrescente",
  884. type:"Tipo",
  885. yingkui:"Resultado e perda",
  886. nolog:"Sem Registro",
  887. more:"Carregar Mais",
  888. nomore:"Não mais.",
  889. ylrate:"Taxa de lucro",
  890. buyup:"Compra aí.",
  891. buydown:"Comprar para baixo",
  892. micro:"Opções de negociação",
  893. model:"Modo de transação",
  894. opennum:"Quantidade de Abertura",
  895. opentime:"Tempo Aberto",
  896. balance:"Balanço de conta",
  897. num1:"Número:",
  898. yuqi:"Receitas previstas:",
  899. circle:"Período de liquidação:",
  900. nowprice:"Preço actual",
  901. ceil:"Cancelar",
  902. ptime:"Por favor, selecione a Hora de Abertura",
  903. pnum:"Seleccione por favor a quantidade de Abertura",
  904. success:"SUCESSO do checkout"
  905. },
  906. ru:{
  907. high:"высота",
  908. low:"низкий",
  909. volume:"24H количество",
  910. num:"количество",
  911. price:"цена",
  912. time:"время",
  913. buy:"покупать",
  914. sell:"продать",
  915. chicang:"Список владельцев бункера",
  916. record:"запись заказа",
  917. buyprice:"покупная цена",
  918. cjprice:"цена сделки",
  919. yuji:"ожидаемая прибыльность",
  920. daotime:"обратный отсчет",
  921. type:"тип",
  922. yingkui:"полный убыток",
  923. nolog:"Пока нет записи",
  924. more:"Загрузить дополнительно",
  925. nomore:"Больше нет",
  926. ylrate:"норма прибыли",
  927. buyup:"купить",
  928. buydown:"упасть",
  929. micro:"опционная сделка",
  930. model:"режим сделок",
  931. opennum:"количество вскрытия",
  932. opentime:"время открытия бункера",
  933. balance:"сальдо счета",
  934. num1:"количество",
  935. yuqi:"Ожидаемые выгоды:",
  936. circle:"расчетный период:",
  937. nowprice:"текущая цена",
  938. ceil:"отмена",
  939. ptime:"Выберите время начала бункера",
  940. pnum:"Выберите количество бункера",
  941. success:"Следующий успех"
  942. },
  943. spa:{
  944. high:"Alto",
  945. low:"Baja",
  946. volume:"Cantidad de 24h",
  947. num:"Cantidad",
  948. price:"Precio",
  949. time:"Tiempo",
  950. buy:"Comprar",
  951. sell:"Vender",
  952. chicang:"Lista de posiciones",
  953. record:"Registro de pedidos",
  954. buyprice:"Precio de compra",
  955. cjprice:"Precio de transacción",
  956. yuji:"Ganancias y pérdidas previstas",
  957. daotime:"Cuenta atrás",
  958. type:"Tipo",
  959. yingkui:"Ganancias y pérdidas",
  960. nolog:"No hay registro",
  961. more:"Cargar más",
  962. nomore:"No más",
  963. ylrate:"Tasa de ganancia",
  964. buyup:"Comprar",
  965. buydown:"Comprar o caer",
  966. micro:"Comercio de opciones",
  967. model:"Modo de transacción",
  968. opennum:"Cantidad de apertura",
  969. opentime:"Tiempo de apertura",
  970. balance:"Saldo de la cuenta",
  971. num1:"Cantidad:",
  972. yuqi:"Ingresos previstos:",
  973. circle:"Período de liquidación:",
  974. nowprice:"Precio actual",
  975. ceil:"Cancelar",
  976. ptime:"Por favor, seleccione el tiempo de apertura",
  977. pnum:"Por favor, seleccione la cantidad de apertura",
  978. success:"Pedido exitoso"
  979. }
  980. },
  981. translatedInfo: {
  982. high:'',
  983. low:'',
  984. volume:'',
  985. buy:'',
  986. sell:''
  987. },
  988. lang: '',
  989. sellType: 'buy',
  990. multipleList: [],
  991. CountDown: '',
  992. balance: '',
  993. rate: '',
  994. numbers: '0.00',
  995. expectedReturn: '0.00',
  996. guaranteeAmount: '0.00',
  997. tradeType: '',
  998. tradeCurrency: [],
  999. tradeCurrencyId: '',
  1000. tradeCurrencyName: '',
  1001. tradeCurrencyData: [],
  1002. tradeNUm: [],
  1003. timeList: [],
  1004. seconds: '',
  1005. inputValue: '',
  1006. profitRatio: '',
  1007. tradeCurrencyIdTest: '',
  1008. secondsTest: '',
  1009. inputValueTest: '',
  1010. profitRatioTest: '',
  1011. balanceTest: '',
  1012. rateTest: '',
  1013. orderData: {
  1014. },
  1015. progress: 100,
  1016. set: null,
  1017. status: 1,
  1018. currencyName: "",
  1019. orderList: [],
  1020. set: null,
  1021. bmbBalance: '',
  1022. sets: null,
  1023. insurancType:[],
  1024. userInsurancId:'',
  1025. page:1,
  1026. hasmore:false,
  1027. plate:'',
  1028. opt: false,
  1029. addid:'',
  1030. isActive:0,
  1031. topnow:1,
  1032. topList:['全部','主流','合约'],
  1033. is_insurance: 0,
  1034. styleColor:'',
  1035. greenColor:'#02C289',
  1036. redColor:'#e86d43'
  1037. },
  1038. filters:{
  1039. fixed4:function(vals){
  1040. var values = iTofixed(vals,4);
  1041. return values;
  1042. },
  1043. toFixeds: function (value) {
  1044. value = Number(value);
  1045. return value.toFixed(2);
  1046. },
  1047. toFixeds1: function (value) {
  1048. value = Number(value);
  1049. return value.toFixed(8);
  1050. },
  1051. toFixed4: function (value, options) {
  1052. value = Number(value);
  1053. return value.toFixed(4);
  1054. },
  1055. toFixedNum: function (value, options) {
  1056. value = Number(value);
  1057. return value.toFixed(0);
  1058. },
  1059. toFixed1: function (value, options) {
  1060. value = Number(value);
  1061. return value.toFixed(1);
  1062. },
  1063. },
  1064. created() {
  1065. var paramsed = get_all_params();
  1066. // if(paramsed.symbol){
  1067. // that.symbol = paramsed.symbol;
  1068. // let c_name = paramsed.symbol.split('/')
  1069. // that.legal_name = c_name[1];
  1070. // that.currency_name = c_name[0];
  1071. // that.legal_id = paramsed.legal_id;
  1072. // that.currency_id = paramsed.currency_id;
  1073. // that.currency_match_id = paramsed.currency_match_id;
  1074. // that.plate = paramsed.plate;
  1075. // that.topnow = paramsed.plate || 1;
  1076. // document.title = that.symbol;
  1077. // }
  1078. if(window.plus){
  1079. if (!plus.storage.getItem('token')) {
  1080. uni.navigateTo({
  1081. url: '/pages/mine/login',
  1082. });
  1083. }
  1084. }else{
  1085. if (localStorage.getItem('token') == null || localStorage.getItem('token') == '') {
  1086. uni.navigateTo({
  1087. url: '/pages/mine/login',
  1088. });
  1089. }
  1090. }
  1091. },
  1092. computed: {
  1093. listenState() { //监听交易对
  1094. return this.symbol;
  1095. }
  1096. },
  1097. watch: {
  1098. listenState: function(a, b) { //监听交易对
  1099. if (a != b && b != '') {
  1100. this.widget.setSymbol(a, localStorage.getItem('tim'), function onReadyCallback() {}) //切换币种
  1101. }
  1102. }
  1103. },
  1104. mounted() {
  1105. var that = this;
  1106. if(window.plus){
  1107. plus.navigator.setStatusBarStyle('light');
  1108. that.lang = plus.storage.getItem('locale');
  1109. that.translatedInfo = that.transwords[that.lang];
  1110. that.styleColor = plus.storage.getItem('color');
  1111. if(that.styleColor=='green'){
  1112. that.greenColor='#02C289';
  1113. that.redColor='#e86d43';
  1114. }else{
  1115. that.greenColor='#e86d43';
  1116. that.redColor='#02C289';
  1117. }
  1118. }else{
  1119. // that.lang = JSON.parse(localStorage.getItem('lang')).data;
  1120. that.lang = localStorage.getItem('locale');
  1121. that.styleColor = localStorage.getItem('color');
  1122. if(that.styleColor=='green'){
  1123. that.greenColor='#02C289';
  1124. that.redColor='#e86d43';
  1125. }else{
  1126. that.greenColor='#e86d43';
  1127. that.redColor='#02C289';
  1128. }
  1129. that.translatedInfo = that.transwords[that.lang];
  1130. }
  1131. this.init();
  1132. this.getSecond();
  1133. this.getWallet();
  1134. // this.getMyAdd()
  1135. // this.createWidget();
  1136. },
  1137. destroyed() {
  1138. this.removeWidget();
  1139. },
  1140. beforeDestroy() {
  1141. },
  1142. methods: {
  1143. changeTop(e){
  1144. this.topnow=e;
  1145. },
  1146. changeTab(e,name){
  1147. // this.fiat_convert_cny=this.marketLists[e].fiat_convert_cny-0;
  1148. this.isActive=e;
  1149. this.legal_name = name;
  1150. },
  1151. getrate(){
  1152. let that = this;
  1153. initDataToken({
  1154. url: 'market/get_current',
  1155. type: "post",
  1156. data:{
  1157. base_currency:that.currency_name,
  1158. quote_currency:that.legal_name,
  1159. period:'1day'
  1160. }
  1161. }, function (res) {
  1162. console.log(JSON.stringify(res));
  1163. that.updown = res.change
  1164. that.dayvom = Number(res.vol).toFixed(4)
  1165. that.maxprice = res.high
  1166. that.minprice = res.low
  1167. that.newprice = res.close
  1168. })
  1169. },
  1170. // getrate(){
  1171. // let that = this;
  1172. // initDataToken({
  1173. // url: 'market/deal',
  1174. // data:{
  1175. // currency_match_id:that.currency_match_id
  1176. // }
  1177. // }, function (res) {
  1178. // let data = res.quotation;
  1179. // that.updown = data.change
  1180. // that.dayvom = Number(data.volume).toFixed(4)
  1181. // that.maxprice = data.high
  1182. // that.minprice = data.low
  1183. // that.newprice = data.close
  1184. // })
  1185. // },
  1186. // 自选添加删除
  1187. toggle(url){
  1188. var that = this;
  1189. that.opt=!that.opt
  1190. initDataToken({
  1191. url: 'user_match/'+url,
  1192. type: "post",
  1193. data:{id:that.currency_match_id},
  1194. }, function (res) {
  1195. layer_msg(res);
  1196. })
  1197. },
  1198. // 我的自选
  1199. getMyAdd(){
  1200. let that = this;
  1201. initDataToken({
  1202. url: 'user_match/list',
  1203. type: "GET",
  1204. }, function (res) {
  1205. console.log(JSON.stringify(res))
  1206. var list = res.data;
  1207. for(var i=0;i<list.length;i++){
  1208. if(list[i].legal_id == that.legal_id && list[i].currency_id == that.currency_id ){
  1209. that.opt= true
  1210. console.log(1)
  1211. }
  1212. }
  1213. })
  1214. },
  1215. init(){
  1216. let that = this;
  1217. initData({ url: 'currency/quotation_new'}, (res, msg) => {
  1218. that.currencyList=res;
  1219. var data1 = res;
  1220. if(!that.legal_id){
  1221. that.legal_id = res[0].id;
  1222. }
  1223. console.log(that.legal_id)
  1224. for (var i = 0; i < data1.length; i++) {
  1225. if (data1[i].id == that.legal_id) {
  1226. var data2 = data1[i].quotation;
  1227. // that.currencyList = data2;
  1228. let data0 = data2[0];
  1229. console.log(data0)
  1230. // var param = get_all_params();
  1231. // if(!param.symbol){
  1232. that.legal_id = data0.legal_id;
  1233. that.currency_id = data0.currency_id;
  1234. that.legal_name = data0.legal_name;
  1235. that.currency_name = data0.currency_name;
  1236. that.currency_match_id = data0.id;
  1237. that.symbol = data0.currency_name+'/'+data0.legal_name;
  1238. // }
  1239. // that.getrate();
  1240. that.createWidget();
  1241. that.orderList = [];
  1242. that.page = 1;
  1243. that.getList();
  1244. }
  1245. }
  1246. // that.getrate();
  1247. // that.createWidget();
  1248. // that.orderList = [];
  1249. // that.page = 1;
  1250. // that.getList();
  1251. })
  1252. },
  1253. //获取期权交易信息
  1254. getWallet(){
  1255. let that = this;
  1256. initDataToken({
  1257. url: 'microtrade/payable_currencies'
  1258. }, function (res) {
  1259. that.tradeCurrency = res;
  1260. // alert(JSON.stringify(res))
  1261. if (res.length > 0) {
  1262. that.tradeCurrencyId = res[0].id;
  1263. that.tradeCurrencyName = res[0].name;
  1264. that.tradeCurrencyIdTest = res[0].id;
  1265. that.tradeNUm = res[0].micro_numbers;
  1266. // that.balance = res[0].micro_account.balance;
  1267. // that.balanceTest = res[0].micro_account.balance;
  1268. that.balance = res[0].user_wallet.micro_with_insurance;
  1269. that.balanceTest = res[0].user_wallet.micro_with_insurance;
  1270. that.rate = res[0].micro_trade_fee;
  1271. that.rateTest = res[0].micro_trade_fee;
  1272. if (that.tradeNUm.length > 0) {
  1273. that.inputValue = (that.tradeNUm[0].number - 0).toFixed(0);
  1274. console.log(that.inputValue)
  1275. that.inputValueTest = that.tradeNUm[0].number;
  1276. }
  1277. }
  1278. that.$forceUpdate();
  1279. })
  1280. },
  1281. //获取开仓时间
  1282. getSecond(){
  1283. let that = this;
  1284. initDataToken({
  1285. url: 'microtrade/seconds'
  1286. }, function (res) {
  1287. that.timeList = res;
  1288. if (res.length > 0) {
  1289. that.seconds = res[0].seconds;
  1290. that.profitRatio = res[0].profit_ratio;
  1291. that.secondsTest = res[0].seconds;
  1292. that.profitRatioTest = res[0].profit_ratio
  1293. }
  1294. })
  1295. },
  1296. //选择交易对
  1297. selectCurrencys(ids, legalId, currencyId, legalName, currencyName,plate_id) {
  1298. console.log(ids, legalId, currencyId, legalName, currencyName,plate_id)
  1299. var that = this;
  1300. that.currency_match_id = ids;
  1301. that.legal_id = legalId;
  1302. that.currency_id = currencyId;
  1303. that.symbol = currencyName + '/' + legalName;
  1304. that.currency_name = currencyName;
  1305. that.legal_name = legalName;
  1306. that.plate = plate_id
  1307. $('#mask1').hide();
  1308. $('#sideColumn').animate({
  1309. left: '-70%'
  1310. }, 100);
  1311. // that.init();
  1312. // this.getrate();
  1313. that.createWidget();
  1314. // that.connects();
  1315. that.getList();
  1316. },
  1317. tradeCurrencyClick(num, names) {
  1318. var that = this;
  1319. that.tradeCurrencyId = num;
  1320. that.tradeCurrencyName = names;
  1321. for (var i = 0; i < that.tradeCurrency.length; i++) {
  1322. if (that.tradeCurrency[i].id == num) {
  1323. that.tradeNUm = that.tradeCurrency[i].micro_numbers;
  1324. if (that.tradeCurrency[i].user_wallet) {
  1325. if(that.is_insurance==0){
  1326. that.balance = that.tradeCurrency[i].user_wallet.micro_balance;
  1327. }else{
  1328. that.balance = that.tradeCurrency[i].user_wallet.insurance_balance;
  1329. }
  1330. }
  1331. that.rate = that.tradeCurrency[i].micro_trade_fee;
  1332. if (that.tradeNUm.length > 0) {
  1333. that.inputValue = (that.tradeNUm[0].number - 0).toFixed(0);
  1334. }
  1335. }
  1336. }
  1337. },
  1338. changeInsurance(types){
  1339. var that = this;
  1340. that.is_insurance= types;
  1341. for (var i = 0; i < that.tradeCurrency.length; i++) {
  1342. if (that.tradeCurrency[i].id == that.tradeCurrencyId) {
  1343. if (that.tradeCurrency[i].user_wallet) {
  1344. if(that.is_insurance==0){
  1345. that.balance = that.tradeCurrency[i].user_wallet.micro_balance;
  1346. }else{
  1347. that.balance = that.tradeCurrency[i].user_wallet.insurance_balance;
  1348. }
  1349. }
  1350. }
  1351. }
  1352. },
  1353. tabNumbers(num) {
  1354. var that = this;
  1355. that.inputValue = (num - 0).toFixed(0);
  1356. },
  1357. // 买入/卖出按钮点击
  1358. buyModal(types) {
  1359. var that = this;
  1360. that.progress = 100;
  1361. layer.closeAll();
  1362. clearInterval(that.set);
  1363. that.tradeType = types;
  1364. var text1 = '';
  1365. var skin = 'confirm-modal btn-text ';
  1366. if (types == 1) {
  1367. text1 = that.translatedInfo.buyup + that.currencyName;
  1368. skin = 'confirm-modal btn-text buys';
  1369. } else {
  1370. text1 = that.translatedInfo.buydown + that.currencyName;
  1371. skin = 'confirm-modal btn-text sells';
  1372. }
  1373. layer.open({
  1374. type: 1,
  1375. title: text1,
  1376. area: ['90%', 'auto'],
  1377. skin: skin,
  1378. content: $('.orders'),
  1379. shadeClose: true,
  1380. btn: [that.translatedInfo.ceil, text1],
  1381. btn2: function (index) {
  1382. that.taderSubmit()
  1383. },
  1384. success: function () {
  1385. }
  1386. })
  1387. },
  1388. slectedTime() {
  1389. var that = this;
  1390. that.progress = 100;
  1391. layer.closeAll();
  1392. clearInterval(that.set);
  1393. layer.open({
  1394. type: 1,
  1395. title: false,
  1396. area: ['100%', 'auto'],
  1397. skin: 'confirm-modal btn-text second-modal',
  1398. content: $('.time-modal'),
  1399. shadeClose: true,
  1400. fixed: true,
  1401. offset: 'b',
  1402. closeBtn: 0,
  1403. // scrollbar: false,
  1404. tipsMore: true,
  1405. btn: [that.translatedInfo.buyup, that.translatedInfo.buydown],
  1406. btn2: function (index) {
  1407. that.buyModal(2);
  1408. },
  1409. yes: function () {
  1410. that.buyModal(1)
  1411. }
  1412. })
  1413. },
  1414. // 下单
  1415. taderSubmit() {
  1416. var that = this;
  1417. if (!that.seconds) {
  1418. layer_msg(that.translatedInfo.ptime);
  1419. return false;
  1420. }
  1421. if (!that.inputValue) {
  1422. layer_msg(that.translatedInfo.pnum);
  1423. return false;
  1424. }
  1425. // else if (that.inputValue % 10 != 0) {
  1426. // layer_msg(getlg('multipleTen'));
  1427. // return false;
  1428. // }
  1429. initDataToken({
  1430. url: 'microtrade/submit',
  1431. data: {
  1432. match_id: that.currency_match_id,
  1433. currency_id: that.tradeCurrencyId,
  1434. type: that.tradeType,
  1435. seconds: that.seconds,
  1436. number: that.inputValue,
  1437. // is_insurance:that.is_insurance
  1438. },
  1439. type: 'post'
  1440. }, function (res) {
  1441. layer_msg(that.translatedInfo.success);
  1442. initDataToken({
  1443. url: 'microtrade/payable_currencies'
  1444. }, function (res) {
  1445. if (res.length > 0) {
  1446. for (var i = 0; i < res.length; i++) {
  1447. if (res[i].id == that.tradeCurrencyId) {
  1448. if(that.is_insurance==0){
  1449. that.balance = res[i].user_wallet.micro_balance
  1450. }else{
  1451. that.balance = res[i].user_wallet.insurance_balance;
  1452. }
  1453. }
  1454. }
  1455. }
  1456. })
  1457. // location.reload();
  1458. that.page = 1;
  1459. that.orderList = [];
  1460. clearTimeout(that.set);
  1461. clearInterval(that.sets);
  1462. that.getList();
  1463. })
  1464. },
  1465. selectTime(num, num1) {
  1466. console.log(num1)
  1467. var that = this;
  1468. that.seconds = num;
  1469. // that.profitRatio = Number(num1)*100;
  1470. that.profitRatio = Number(num1);
  1471. },
  1472. // 显示左侧
  1473. showLeft() {
  1474. var that = this;
  1475. $('#mask1').show();
  1476. $('#sideColumn').animate({
  1477. left: '0'
  1478. }, 100);
  1479. },
  1480. // 关闭左侧
  1481. closeLeft() {
  1482. var that = this;
  1483. $('#mask1').hide();
  1484. $('#sideColumn').animate({
  1485. left: '-70%'
  1486. }, 100);
  1487. },
  1488. // 获取期权交易订单列表
  1489. getList() {
  1490. var that = this;
  1491. // that.orderList = [];
  1492. var arr = [];
  1493. clearTimeout(that.set);
  1494. clearInterval(that.sets);
  1495. initDataToken({
  1496. url: 'microtrade/lists',
  1497. data: {
  1498. page: that.page,
  1499. status: that.status,
  1500. limit:10,
  1501. match_id: that.currency_match_id
  1502. }
  1503. }, function (res) {
  1504. that.hasmore = res.current_page<res.last_page ? true : false;
  1505. arr = res.data;
  1506. if(that.page==1){
  1507. that.orderList=[];
  1508. }else{
  1509. arr = that.orderList.concat(arr);
  1510. }
  1511. if (arr.length > 0) {
  1512. var nowTime = new Date().getTime();
  1513. for (var i = 0; i < arr.length; i++) {
  1514. arr[i].endTime = (nowTime - 0) + (arr[i].remain_milli_seconds - 0);
  1515. }
  1516. that.orderList = arr;
  1517. that.Djs_time();
  1518. that.set = setTimeout(that.countDown, 200);
  1519. }
  1520. })
  1521. },
  1522. getmore(){
  1523. this.page++;
  1524. this.getList();
  1525. },
  1526. // 订单倒计时
  1527. countDown(val, indexs, seconds, relSeconds) {
  1528. var that = this;
  1529. var timeValue = '';
  1530. // var process = 100 / Number(seconds);
  1531. var endItem = val; //获取列表传的截止时间
  1532. var nowItem = new Date().getTime(); //获取当前时间
  1533. var timeSpace = endItem - nowItem; //截止时间减去当前时间
  1534. var seconds = '';
  1535. if (timeSpace > 0) {
  1536. seconds = (timeSpace / 1000).toFixed(1);
  1537. console.log(seconds)
  1538. return seconds;
  1539. } else if (timeSpace <= 0) {
  1540. return 0.0;
  1541. // 倒计时结束打开
  1542. // clearTimeout(that.set);
  1543. // var arr = that.orderList;
  1544. // arr.splice(indexs,1)
  1545. // that.orderList = arr;
  1546. // console.log(that.orderList.splice(indexs,1))
  1547. // that.orderList = that.orderList.splice(indexs,1);
  1548. // that.getList();
  1549. // 或者刷新页面
  1550. // location.reload();
  1551. }
  1552. },
  1553. Djs_time: function () {
  1554. this.sets = setInterval(() => {
  1555. var presentTime = new Date().getTime();
  1556. this.CountDown = presentTime
  1557. }, 200);
  1558. },
  1559. // 选择期权交易订单类型
  1560. selectOrder(types) {
  1561. var that = this;
  1562. that.status = types;
  1563. that.page = 1;
  1564. that.orderList = [];
  1565. that.getList();
  1566. },
  1567. goback() {
  1568. if(window.plus){
  1569. uni.navigateBack({
  1570. delta: 1
  1571. });
  1572. }else{
  1573. history.back(-1);
  1574. }
  1575. },
  1576. golever(){
  1577. var data = {
  1578. legalId: this.legal_id,
  1579. currencyId: this.currency_id,
  1580. plateId: this.plate
  1581. };
  1582. if(window.plus){
  1583. plus.storage.setItem('leverOrder', JSON.stringify(data));
  1584. }else{
  1585. localStorage.setItem('leverOrder', JSON.stringify(data));
  1586. }
  1587. uni.switchTab({
  1588. url: '/pages/lever/lever'
  1589. })
  1590. },
  1591. // goTrade(mytype) {
  1592. // let localData = {
  1593. // legal_name: this.legal_name,
  1594. // legal_id: this.legal_id,
  1595. // currency_name: this.currency_name,
  1596. // currency_id: this.currency_id,
  1597. // match_id:this.currency_match_id
  1598. // }
  1599. // if(window.plus){
  1600. // plus.storage.setItem('tradeData', JSON.stringify(localData));
  1601. // plus.storage.setItem('tradeType', mytype);
  1602. // }else{
  1603. // localStorage.setItem('tradeData', JSON.stringify(localData));
  1604. // localStorage.setItem('tradeType', mytype);
  1605. // }
  1606. // uni.switchTab({
  1607. // url: '/pages/trade/trade'
  1608. // })
  1609. // },
  1610. timestampToTime(timestamp) {
  1611. var time=''
  1612. if(timestamp.toString().length>11){
  1613. time=timestamp
  1614. }else{
  1615. time=timestamp*1000
  1616. }
  1617. var now = new Date(time),
  1618.    y = now.getFullYear(),
  1619.    m = now.getMonth() + 1,
  1620.    d = now.getDate();
  1621.    return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
  1622. },
  1623. // 默认
  1624. connect(real) { //封装推送数据
  1625. var that = this,tokens='';
  1626. if(window.plus){
  1627. if (plus.storage.getItem('uid')) {
  1628. tokens=JSON.parse(plus.storage.getItem('uid')).data
  1629. }
  1630. }else{
  1631. if(localStorage.getItem('uid')){
  1632. tokens = JSON.parse(localStorage.getItem('uid')).data;
  1633. }
  1634. }
  1635. var socket=io(socket_api);
  1636. socket.emit('login',tokens);
  1637. socket.on('kline', msg=>{
  1638. if (msg.type == 'kline') {
  1639. let obj = {};
  1640. var types = localStorage.getItem('type');
  1641. if (that.symbol == msg.symbol) {
  1642. let data = msg;
  1643. if (data.period == types) {
  1644. obj.open = Number(data.open)
  1645. obj.low = Number(data.low)
  1646. obj.high = Number(data.high)
  1647. obj.close = Number(data.close)
  1648. obj.volume = Number(data.volume)
  1649. obj.time = Number(data.time)
  1650. real(obj)
  1651. }
  1652. }
  1653. }
  1654. });
  1655. socket.on('daymarket', msg=> {
  1656. if (msg.type == 'daymarket') {
  1657. if (that.symbol == msg.symbol) {
  1658. let datas = msg;
  1659. that.newprice = datas.close;
  1660. that.maxprice = datas.high;
  1661. that.minprice = datas.low;
  1662. that.dayvom = Number(datas.volume).toFixed(4);
  1663. that.updown = datas.change;
  1664. }
  1665. }
  1666. });
  1667. socket.on('closed_microorder', msg=> {
  1668. if (msg.type == 'closed_microorder') {
  1669. for (var i = 0; i < that.orderList.length; i++) {
  1670. if (that.orderList[i].id == datas.id) {
  1671. that.orderList[i] = datas;
  1672. setTimeout( ()=> {
  1673. var arr = that.orderList;
  1674. arr.splice(i, 1)
  1675. that.orderList = arr;
  1676. }, 500)
  1677. return false;
  1678. }
  1679. }
  1680. }
  1681. });
  1682. },
  1683. createWidget() {
  1684. let _this = this;
  1685. this.$nextTick(()=> {
  1686. let widget = _this.widget = new TradingView.widget({
  1687. symbol: _this.symbol,
  1688. interval: 1,
  1689. debug: true,
  1690. fullscreen: false,
  1691. autosize: true,
  1692. container_id: "tv_chart_container",
  1693. // datafeed: new Datafeeds.UDFCompatibleDatafeed("http://demo_feed.tradingview.com"),
  1694. datafeed: _this.createFeed(),
  1695. library_path: "tradeview/charting_library/",
  1696. custom_css_url: 'bundles/new.css',
  1697. locale: _this.lang,
  1698. width: "100%",
  1699. height: 516,
  1700. drawings_access: {
  1701. type: 'black',
  1702. tools: [{
  1703. name: "Regression Trend"
  1704. }]
  1705. },
  1706. disabled_features: [ // 禁用的功能
  1707. 'left_toolbar', 'widget_logo', 'header_saveload', 'compare_symbol', 'display_market_status',
  1708. 'go_to_date', 'header_chart_type', 'header_compare', 'header_interval_dialog_button',
  1709. 'header_resolutions', 'header_screenshot', 'header_symbol_search', 'header_undo_redo',
  1710. 'legend_context_menu', 'show_hide_button_in_legend', 'show_interval_dialog_on_key_press',
  1711. 'snapshot_trading_drawings', 'symbol_info', 'timeframes_toolbar', 'use_localstorage_for_settings',
  1712. 'volume_force_overlay'
  1713. ],
  1714. enabled_features: [ // 启用的功能(备注:disable_resolution_rebuild 功能用于控制当时间范围为1个月时,日期刻度是否都是每个月1号
  1715. 'dont_show_boolean_study_arguments', 'hide_last_na_study_output', 'move_logo_to_main_pane',
  1716. 'same_data_requery', 'side_toolbar_in_fullscreen_mode', 'disable_resolution_rebuild'
  1717. ],
  1718. charts_storage_url: 'http://saveload.tradingview.com',
  1719. charts_storage_api_version: "1.1",
  1720. toolbar_bg: "transparent",
  1721. timezone: "Asia/Shanghai",
  1722. studies_overrides: {
  1723. "volume.volume.color.0": this.redColor,
  1724. "volume.volume.color.1": this.greenColor,
  1725. 'volume.precision': '1000'
  1726. },
  1727. overrides: _this.overrides()
  1728. });
  1729. widget.MAStudies = [];
  1730. widget.selectedIntervalButton = null;
  1731. // widget.setLanguage('en')
  1732. widget.onChartReady(function() { //图表方法
  1733. // document.getElementById('trade-view').childNodes[0].setAttribute('style', 'display:block;width:100%;height:100%;');
  1734. //let that =this
  1735. widget.chart().createStudy('Moving Average', false, true, [15, 'close', 0], null, {
  1736. 'Plot.color': '#e843da'
  1737. });
  1738. widget.chart().createStudy("MA Cross", false, false, [10, 20]);
  1739. let buttonArr = [{
  1740. value: "1min",
  1741. period: "1",
  1742. text: "Time",
  1743. chartType: 3,
  1744. type: "1min"
  1745. },
  1746. {
  1747. value: "1",
  1748. period: "1m",
  1749. text: "1min",
  1750. chartType: 1,
  1751. type: "1min"
  1752. },
  1753. {
  1754. value: "5",
  1755. period: "5m",
  1756. text: "5min",
  1757. chartType: 1,
  1758. type: "5min"
  1759. },
  1760. {
  1761. value: "30",
  1762. period: "30m",
  1763. text: "30min",
  1764. chartType: 1,
  1765. type: "30min"
  1766. },
  1767. {
  1768. value: "60",
  1769. period: "60分钟",
  1770. text: "1hour",
  1771. chartType: 1,
  1772. type: "60min"
  1773. },
  1774. {
  1775. value: "1D",
  1776. period: "1D",
  1777. text: "1day",
  1778. chartType: 1,
  1779. type: "1day"
  1780. },
  1781. {
  1782. value: "1W",
  1783. period: "1W",
  1784. text: "1week",
  1785. chartType: 1,
  1786. type: "1week"
  1787. },
  1788. {
  1789. value: "1M",
  1790. period: "1M",
  1791. text: "1mon",
  1792. chartType: 1,
  1793. type: "1mon"
  1794. }
  1795. ];
  1796. let btn = {};
  1797. let nowTime = '';
  1798. buttonArr.forEach((v, i) => {
  1799. let button = widget.createButton()
  1800. button.attr('title', v.text)
  1801. .addClass("my2")
  1802. .text(v.text)
  1803. if (v.text == '1min') {
  1804. button.css({
  1805. 'color': '#218bde',
  1806. 'border-bottom': '1px solid #218bde'
  1807. })
  1808. localStorage.setItem('tim', '1min') //默认为1分钟
  1809. localStorage.setItem('type', '1min') //默认为1分钟
  1810. }
  1811. btn = button.on("click", function(e) {
  1812. $(this).parents(".left").children().find(".my2").removeAttr("style"); //去掉1分钟的
  1813. handleClick(e, v.value, v.type);
  1814. widget.chart().setChartType(v.chartType); //改变K线类型
  1815. });
  1816. });
  1817. if (localStorage.getItem('tim') == '1min') {
  1818. widget.chart().setChartType(1);
  1819. }
  1820. let handleClick = (e, value, type) => {
  1821. _this.setSymbol = function(symbol, value) {
  1822. gh.chart().setSymbol(symbol, value);
  1823. };
  1824. localStorage.setItem('tim', value);
  1825. localStorage.setItem('type', type) //默认为1分钟
  1826. widget.chart().setResolution(value, function onReadyCallback() {}); //改变分辨率
  1827. $(e.target)
  1828. .addClass("mydate")
  1829. .closest("div.space-single")
  1830. .siblings("div.space-single")
  1831. .find("div.button")
  1832. .removeClass("mydate")
  1833. };
  1834. });
  1835. _this.widget = widget;
  1836. })
  1837. },
  1838. createFeed() {
  1839. let this_vue = this;
  1840. let Datafeed = {};
  1841. Datafeed.DataPulseUpdater = function(datafeed, updateFrequency) {
  1842. this._datafeed = datafeed;
  1843. this._subscribers = {};
  1844. this._requestsPending = 0;
  1845. var that = this;
  1846. var update = function() {
  1847. if (that._requestsPending > 0) {
  1848. return;
  1849. }
  1850. for (var listenerGUID in that._subscribers) {
  1851. var subscriptionRecord = that._subscribers[listenerGUID];
  1852. var resolution = subscriptionRecord.resolution;
  1853. var datesRangeRight = parseInt((new Date().valueOf()) / 1000);
  1854. // BEWARE: please note we really need 2 bars, not the only last one
  1855. // see the explanation below. `10` is the `large enough` value to work around holidays
  1856. var datesRangeLeft = datesRangeRight - that.periodLengthSeconds(resolution, 10);
  1857. that._requestsPending++;
  1858. (function(_subscriptionRecord) { // eslint-disable-line
  1859. that._datafeed.getBars(_subscriptionRecord.symbolInfo, resolution, datesRangeLeft, datesRangeRight,
  1860. function(bars) {
  1861. that._requestsPending--;
  1862. // means the subscription was cancelled while waiting for data
  1863. if (!that._subscribers.hasOwnProperty(listenerGUID)) {
  1864. return;
  1865. }
  1866. if (bars.length === 0) {
  1867. return;
  1868. }
  1869. var lastBar = bars[bars.length - 1];
  1870. if (!isNaN(_subscriptionRecord.lastBarTime) && lastBar.time < _subscriptionRecord.lastBarTime) {
  1871. return;
  1872. }
  1873. var subscribers = _subscriptionRecord.listeners;
  1874. // BEWARE: this one isn't working when first update comes and this update makes a new bar. In this case
  1875. // _subscriptionRecord.lastBarTime = NaN
  1876. var isNewBar = !isNaN(_subscriptionRecord.lastBarTime) && lastBar.time > _subscriptionRecord.lastBarTime;
  1877. // 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
  1878. // old bar's last 5 seconds trades will be lost). Thus, at fist we should broadcast old bar updates when it's ready.
  1879. if (isNewBar) {
  1880. if (bars.length < 2) {
  1881. throw new Error('Not enough bars in history for proper pulse update. Need at least 2.');
  1882. }
  1883. var previousBar = bars[bars.length - 2];
  1884. for (var i = 0; i < subscribers.length; ++i) {
  1885. subscribers[i](previousBar);
  1886. }
  1887. }
  1888. _subscriptionRecord.lastBarTime = lastBar.time;
  1889. for (var i = 0; i < subscribers.length; ++i) {
  1890. subscribers[i](lastBar);
  1891. }
  1892. },
  1893. // on error
  1894. function() {
  1895. that._requestsPending--;
  1896. });
  1897. })(subscriptionRecord);
  1898. }
  1899. };
  1900. if (typeof updateFrequency != 'undefined' && updateFrequency > 0) {
  1901. setInterval(update, updateFrequency);
  1902. }
  1903. };
  1904. Datafeed.DataPulseUpdater.prototype.periodLengthSeconds = function(resolution, requiredPeriodsCount) {
  1905. var daysCount = 0;
  1906. if (resolution === 'D') {
  1907. daysCount = requiredPeriodsCount;
  1908. } else if (resolution === 'M') {
  1909. daysCount = 31 * requiredPeriodsCount;
  1910. } else if (resolution === 'W') {
  1911. daysCount = 7 * requiredPeriodsCount;
  1912. } else {
  1913. daysCount = requiredPeriodsCount * resolution / (24 * 60);
  1914. }
  1915. return daysCount * 24 * 60 * 60;
  1916. };
  1917. Datafeed.DataPulseUpdater.prototype.subscribeDataListener = function(symbolInfo, resolution, newDataCallback,
  1918. listenerGUID) {
  1919. this._datafeed._logMessage('Subscribing ' + listenerGUID);
  1920. if (!this._subscribers.hasOwnProperty(listenerGUID)) {
  1921. this._subscribers[listenerGUID] = {
  1922. symbolInfo: symbolInfo,
  1923. resolution: resolution,
  1924. lastBarTime: NaN,
  1925. listeners: []
  1926. };
  1927. }
  1928. this._subscribers[listenerGUID].listeners.push(newDataCallback);
  1929. };
  1930. Datafeed.DataPulseUpdater.prototype.unsubscribeDataListener = function(listenerGUID) {
  1931. this._datafeed._logMessage('Unsubscribing ' + listenerGUID);
  1932. delete this._subscribers[listenerGUID];
  1933. };
  1934. Datafeed.Container = function(updateFrequency) {
  1935. this._configuration = {
  1936. supports_search: false,
  1937. supports_group_request: false,
  1938. supported_resolutions: ['1', '3', '5', '15', '30', '60', '120', '240', '360', '720', '1D', '3D', '1W',
  1939. '1M'
  1940. ],
  1941. supports_marks: true,
  1942. supports_timescale_marks: true,
  1943. exchanges: ['gh']
  1944. };
  1945. this._barsPulseUpdater = new Datafeed.DataPulseUpdater(this, updateFrequency || 10 * 1000);
  1946. // this._quotesPulseUpdater = new Datafeed.QuotesPulseUpdater(this);
  1947. this._enableLogging = true;
  1948. this._callbacks = {};
  1949. this._initializationFinished = true;
  1950. this._fireEvent('initialized');
  1951. this._fireEvent('configuration_ready');
  1952. };
  1953. Datafeed.Container.prototype._fireEvent = function(event, argument) {
  1954. if (this._callbacks.hasOwnProperty(event)) {
  1955. var callbacksChain = this._callbacks[event];
  1956. for (var i = 0; i < callbacksChain.length; ++i) {
  1957. callbacksChain[i](argument);
  1958. }
  1959. this._callbacks[event] = [];
  1960. }
  1961. };
  1962. Datafeed.Container.prototype._logMessage = function(message) {
  1963. if (this._enableLogging) {
  1964. var now = new Date();
  1965. }
  1966. };
  1967. Datafeed.Container.prototype.on = function(event, callback) {
  1968. if (!this._callbacks.hasOwnProperty(event)) {
  1969. this._callbacks[event] = [];
  1970. }
  1971. this._callbacks[event].push(callback);
  1972. return this;
  1973. };
  1974. Datafeed.Container.prototype.onReady = function(callback) {
  1975. let that = this;
  1976. if (this._configuration) {
  1977. setTimeout(function() {
  1978. callback(that._configuration);
  1979. }, 0);
  1980. } else {
  1981. this.on('configuration_ready', function() {
  1982. callback(that._configuration);
  1983. });
  1984. }
  1985. };
  1986. Datafeed.Container.prototype.resolveSymbol = function(symbolName, onSymbolResolvedCallback,
  1987. onResolveErrorCallback) {
  1988. this._logMessage("GOWNO :: resolve symbol " + symbolName);
  1989. Promise.resolve().then(() => {
  1990. // this._logMessage("GOWNO :: onResultReady inject "+'AAPL');
  1991. onSymbolResolvedCallback({
  1992. "name": this_vue.symbol,
  1993. "timezone": "Asia/Shanghai",
  1994. "pricescale": this_vue.priceScale,
  1995. "minmov": 1, //minmov(最小波动), pricescale(价格精度), minmove2, fractional(分数)
  1996. "minmov2": 0, //这是一个神奇的数字来格式化复杂情况下的价格。
  1997. "ticker": this_vue.symbol,
  1998. "description": "",
  1999. "type": "bitcoin",
  2000. "volume_precision": 8,
  2001. // "exchange-traded": "sdt",
  2002. // "exchange-listed": "sdt",
  2003. //现在,这两个字段都为某个交易所的略称。将被显示在图表的图例中,以表示此商品。目前此字段不用于其他目的。
  2004. "has_intraday": true,
  2005. "has_weekly_and_monthly": true,
  2006. "has_no_volume": false, //布尔表示商品是否拥有成交量数据。
  2007. 'session': '24x7',
  2008. 'supported_resolutions': ['1', '3', '5', '15', '30', '60', '120', '240', '360', '720', '1D', '3D',
  2009. '1W',
  2010. '1M'
  2011. ]
  2012. });
  2013. })
  2014. };
  2015. //初始化数据
  2016. Datafeed.Container.prototype.getBars = function(symbolInfo, resolution, rangeStartDate, rangeEndDate,
  2017. onHistoryCallback, onErrorCallback) {
  2018. // if (rangeStartDate > 0 && (rangeStartDate + '').length > 10) {
  2019. // throw new Error(['Got a JS time instead of Unix one.', rangeStartDate, rangeEndDate]);
  2020. // }
  2021. if (resolution.indexOf('D') == -1 && resolution.indexOf('W') == -1 && resolution.indexOf('M') == -1) {
  2022. resolution = resolution + 'min'
  2023. } else if (resolution.indexOf('W') != -1 || resolution.indexOf('M') != -1) {
  2024. resolution = resolution
  2025. }
  2026. // console.log(rangeStartDate);
  2027. // console.log(rangeEndDate)
  2028. // console.log(resolution);
  2029. // console.log(JSON.stringify(symbolInfo) )
  2030. $.ajax({
  2031. url: this_vue.url + 'api/currency/new_timeshar?' + 'from=' + rangeStartDate + '&to=' + rangeEndDate +
  2032. '&symbol=' + symbolInfo.name + '&period=' + resolution,
  2033. type: 'get',
  2034. success: function(res) {
  2035. // console.log(res.data)
  2036. // console.log(JSON.stringify(res))
  2037. if (res.code == 1 && res.data && res.data.length > 0) {
  2038. res.data.forEach((item, i) => {
  2039. item.open = Number(item.open)
  2040. item.close = Number(item.close)
  2041. item.high = Number(item.high)
  2042. item.low = Number(item.low)
  2043. // if(len==i){
  2044. // console.log(i)
  2045. // this_vue.newprice = item.close - 0
  2046. // this_vue.maxprice = item.high - 0
  2047. // this_vue.minprice = item.low - 0
  2048. // this_vue.dayvom = Number(item.vol).toFixed(2);
  2049. // this_vue.updown = ((item.close - item.open) / (item.open - 0) * 100).toFixed(4).toString();
  2050. // }
  2051. })
  2052. onHistoryCallback(res.data, {
  2053. noData: false
  2054. })
  2055. onHistoryCallback([], {
  2056. noData: true
  2057. })
  2058. }
  2059. if (!res.data || res.code == -1) {
  2060. onHistoryCallback([], {
  2061. noData: true
  2062. })
  2063. }
  2064. if (res.data && res.data.length == 0) {
  2065. onHistoryCallback([], {
  2066. noData: true
  2067. })
  2068. }
  2069. }
  2070. })
  2071. };
  2072. //实时数据
  2073. Datafeed.Container.prototype.subscribeBars = function(symbolInfo, resolution, onRealtimeCallback,
  2074. listenerGUID,
  2075. onResetCacheNeededCallback) {
  2076. this_vue.connect(onRealtimeCallback)
  2077. //this._barsPulseUpdater.subscribeDataListener(symbolInfo, resolution, onRealtimeCallback, listenerGUID, onResetCacheNeededCallback);
  2078. };
  2079. Datafeed.Container.prototype.unsubscribeBars = function(listenerGUID) {
  2080. this._barsPulseUpdater.unsubscribeDataListener(listenerGUID);
  2081. };
  2082. return new Datafeed.Container;
  2083. },
  2084. updateWidget(item) {
  2085. this.symbolInfo = {
  2086. name: item,
  2087. ticker: item,
  2088. description: "",
  2089. session: "24x7",
  2090. supported_resolutions: ['1', '5', '30', '60', '240', '1D', '3D', '1W', '1M'],
  2091. has_intraday: true,
  2092. has_daily: true,
  2093. has_weekly_and_monthly: true,
  2094. timezone: "UTC",
  2095. }
  2096. this.removeWidget();
  2097. this.createWidget();
  2098. },
  2099. removeWidget() {
  2100. if (this.widget) {
  2101. this.widget.remove();
  2102. this.widget = null;
  2103. }
  2104. },
  2105. overrides() {
  2106. let style = {
  2107. up: this.greenColor,
  2108. down: this.redColor,
  2109. bg: "#131f30",
  2110. grid: "#1E2740",
  2111. cross: "#1E2740",
  2112. border: "#4e5b85",
  2113. text: "#61688A",
  2114. areatop: "rgba(122, 152, 247, .1)",
  2115. areadown: "rgba(122, 152, 247, .02)"
  2116. };
  2117. return {
  2118. 'volumePaneSize': "small", //large, medium, small, tiny
  2119. 'paneProperties.topMargin': '20',
  2120. "scalesProperties.lineColor": style.bg,
  2121. "scalesProperties.textColor": style.text,
  2122. "paneProperties.background": style.bg, //改变背景色的重要代码
  2123. "paneProperties.vertGridProperties.color": style.grid,
  2124. "paneProperties.horzGridProperties.color": style.grid,
  2125. "paneProperties.crossHairProperties.color": style.cross,
  2126. "paneProperties.legendProperties.showLegend": true,
  2127. "paneProperties.legendProperties.showStudyArguments": true,
  2128. "paneProperties.legendProperties.showStudyTitles": true,
  2129. "paneProperties.legendProperties.showStudyValues": true,
  2130. "paneProperties.legendProperties.showSeriesTitle": true,
  2131. "paneProperties.legendProperties.showSeriesOHLC": true,
  2132. "mainSeriesProperties.candleStyle.upColor": style.up,
  2133. "mainSeriesProperties.candleStyle.downColor": style.down,
  2134. "mainSeriesProperties.candleStyle.drawWick": true,
  2135. "mainSeriesProperties.candleStyle.drawBorder": true,
  2136. "mainSeriesProperties.candleStyle.borderColor": style.border,
  2137. "mainSeriesProperties.candleStyle.borderUpColor": style.up,
  2138. "mainSeriesProperties.candleStyle.borderDownColor": style.down,
  2139. "mainSeriesProperties.candleStyle.wickUpColor": style.up,
  2140. "mainSeriesProperties.candleStyle.wickDownColor": style.down,
  2141. "mainSeriesProperties.candleStyle.barColorsOnPrevClose": false,
  2142. "mainSeriesProperties.hollowCandleStyle.upColor": style.up,
  2143. "mainSeriesProperties.hollowCandleStyle.downColor": style.down,
  2144. "mainSeriesProperties.hollowCandleStyle.drawWick": true,
  2145. "mainSeriesProperties.hollowCandleStyle.drawBorder": true,
  2146. "mainSeriesProperties.hollowCandleStyle.borderColor": style.border,
  2147. "mainSeriesProperties.hollowCandleStyle.borderUpColor": style.up,
  2148. "mainSeriesProperties.hollowCandleStyle.borderDownColor": style.down,
  2149. "mainSeriesProperties.hollowCandleStyle.wickColor": style.line,
  2150. "mainSeriesProperties.haStyle.upColor": style.up,
  2151. "mainSeriesProperties.haStyle.downColor": style.down,
  2152. "mainSeriesProperties.haStyle.drawWick": true,
  2153. "mainSeriesProperties.haStyle.drawBorder": true,
  2154. "mainSeriesProperties.haStyle.borderColor": style.border,
  2155. "mainSeriesProperties.haStyle.borderUpColor": style.up,
  2156. "mainSeriesProperties.haStyle.borderDownColor": style.down,
  2157. "mainSeriesProperties.haStyle.wickColor": style.border,
  2158. "mainSeriesProperties.haStyle.barColorsOnPrevClose": false,
  2159. "mainSeriesProperties.barStyle.upColor": style.up,
  2160. "mainSeriesProperties.barStyle.downColor": style.down,
  2161. "mainSeriesProperties.barStyle.barColorsOnPrevClose": false,
  2162. "mainSeriesProperties.barStyle.dontDrawOpen": false,
  2163. "mainSeriesProperties.lineStyle.color": style.border,
  2164. "mainSeriesProperties.lineStyle.linewidth": 1,
  2165. "mainSeriesProperties.lineStyle.priceSource": "close",
  2166. "mainSeriesProperties.areaStyle.color1": style.areatop,
  2167. "mainSeriesProperties.areaStyle.color2": style.areadown,
  2168. "mainSeriesProperties.areaStyle.linecolor": style.borders,
  2169. "mainSeriesProperties.areaStyle.linewidth": 1,
  2170. "mainSeriesProperties.areaStyle.priceSource": "close"
  2171. }
  2172. },
  2173. chose() {
  2174. this.widget.setLanguage('en') //设置语言
  2175. }
  2176. },
  2177. })
  2178. })
  2179. </script>
  2180. </body>
  2181. </html>