[ // 'class' => AccessControl::className(), // 'rules' => [ // [ // 'actions' => ['login', 'error', 'index','testcreatequeue'], // 'allow' => true, // ], // [ // 'actions' => ['logout'], // 'allow' => true, // 'roles' => ['@'], // ], // ], // ], // 'verbs' => [ // 'class' => VerbFilter::className(), // 'actions' => [ // 'logout' => ['post'], // ], // ], // ]; // } /** * @inheritdoc */ public function actions() { return [ 'error' => [ 'class' => 'yii\web\ErrorAction', ], ]; } /** * Displays homepage. * * @return string */ public function actionIndex() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); header('Access-Control-Allow-Headers:x-requested-with,content-type'); $data= "{\"id\":[0,1,2,3,4,5],\"time\":[1524787200,1524441600,1524182400,1524182400,1523491200,1522195200],\"color\":[\"red\",\"blue\",\"green\",\"red\",\"blue\",\"green\"],\"text\":[\"Today\",\"4 days back\",\"7 days back + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\",\"7 days back once again\",\"15 days back\",\"30 days back\"],\"label\":[\"A\",\"B\",\"CORE\",\"D\",\"EURO\",\"F\"],\"labelFontColor\":[\"white\",\"white\",\"red\",\"#FFFFFF\",\"white\",\"#000\"],\"minSize\":[14,28,7,40,7,14]}"; echo ($data); } /** * Displays homepage. * * @return string */ public function actionConfig() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); header('Access-Control-Allow-Headers:x-requested-with,content-type'); $data= "{\"supports_search\":false,\"supports_group_request\":true, \"supports_marks\":false,\"supports_timescale_marks\":false,\"supports_time\":false, \"exchanges\":[{\"value\":\"\",\"name\":\"All Exchanges\",\"desc\":\"\"},{\"value\":\"NasdaqNM\",\"name\":\"NasdaqNM\",\"desc\":\"NasdaqNM\"},{\"value\":\"NYSE\",\"name\":\"NYSE\",\"desc\":\"NYSE\"},{\"value\":\"NCM\",\"name\":\"NCM\",\"desc\":\"NCM\"},{\"value\":\"NGM\",\"name\":\"NGM\",\"desc\":\"NGM\"}],\"symbols_types\":[{\"name\":\"All types\",\"value\":\"\"},{\"name\":\"Stock\",\"value\":\"stock\"},{\"name\":\"Index\",\"value\":\"index\"}],\"supported_resolutions\":[\"D\",\"2D\",\"3D\",\"W\",\"3W\",\"M\",\"6M\"]}"; // $data=" //{ // \"supports_search\": false, // \"supports_group_request\": true, // \"supports_marks\": false, // \"supports_timescale_marks\": false, // \"supports_time\": false, // \"exchanges\": [ // { // \"value\": \"中国第一股票\", // \"name\": \"All Exchanges\", // \"desc\": \"中国第一股票\" // } // ], // \"symbols_types\": [ // { // \"name\": \"All types\", // \"value\": \"\" // } // ], // \"supported_resolutions\": [ // \"D\", // \"2D\", // \"6M\" // ] //}"; $data=" { \"supports_search\": true, \"supports_group_request\": true, \"supports_marks\": false, \"supports_timescale_marks\": false, \"supports_time\": true, \"exchanges\": [ { \"value\": \"BTCUSDT\", \"name\": \"BTCUSDT\", \"desc\": \"BTCUSDT\" } , { \"value\": \"BTCUSDT1\", \"name\": \"BTCUSDT1\", \"desc\": \"BTCUSDT1\" } ], \"symbols_types\": [ { \"name\": \"stock\", \"value\": \"BTCUSDT\" } , { \"name\": \"All types\", \"value\": \"\" } ], \"has_no_volume\": true, \"supported_resolutions\":[ \"1\", \"3\", \"5\", \"15\", \"30\", \"60\", \"120\", \"240\", \"360\", \"720\", \"D\", \"3D\", \"5D\", \"7D\", \"15D\", \"M\" ] }"; echo ($data); } /** * Displays homepage. * * @return string */ public function actionMarks() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); header('Access-Control-Allow-Headers:x-requested-with,content-type'); $data= "{\"id\":[0,1,2,3,4,5],\"time\":[1524787200,1524441600,1524182400,1524182400,1523491200,1522195200],\"color\":[\"red\",\"blue\",\"green\",\"red\",\"blue\",\"green\"],\"text\":[\"Today\",\"4 days back\",\"7 days back + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\",\"7 days back once again\",\"15 days back\",\"30 days back\"],\"label\":[\"A\",\"B\",\"CORE\",\"D\",\"EURO\",\"F\"],\"labelFontColor\":[\"white\",\"white\",\"red\",\"#FFFFFF\",\"white\",\"#000\"],\"minSize\":[14,28,7,40,7,14]}"; echo ($data); } /** * Displays homepage. * * @return string */ public function actionSearch() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); header('Access-Control-Allow-Headers:x-requested-with,content-type'); $data= "[ { \"symbol\": \"BTCUSDT\", \"full_name\": \"BTCUSDT\", \"description\": \"BTCUSDT Inc.\", \"exchange\": \"BTCUSDT\", \"type\": \"stock\" }, { \"symbol\": \"BTCUSDT1\", \"full_name\": \"BTCUSDT1\", \"description\": \"BTCUSDT1 Inc.\", \"exchange\": \"BTCUSDT1\", \"type\": \"stock\" } ]"; echo ($data); } /** * Displays homepage. * * @return string */ public function actionSymbol_info() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); header('Access-Control-Allow-Headers:x-requested-with,content-type'); $data= "{ \"symbol\": [ \"BTCUSDT\", \"BTCUSDT1\" ], \"description\": [ \"BTCUSDT\" , \"BTCUSDT1\" ], \"exchange-listed\": \"中国第一股\", \"exchange-traded\": \"快速交易\", \"minmov\": 1, \"minmov2\": 0, \"pricescale\": [ 1 ], \"has-intraday\": true, \"has_no_volume\": true, \"has_weekly_and_monthly\": true, \"has_seconds\": true, \"has_daily\": true, \"intraday_multipliers\": [ 1 ], \"volume_precision\": [ 3 ], \"supported_resolutions\": [ \"1\", \"3\", \"5\", \"15\", \"30\", \"60\", \"120\", \"240\", \"360\", \"720\", \"D\", \"3D\", \"5D\", \"7D\", \"15D\", \"M\" ], \"type\": [ \"stock\" ], \"ticker\": [ \"BTCUSDT\", \"BTCUSDT1\" ], \"timezone\": \"America/New_York\", \"session-regular\": \"0900-1600\" }"; echo ($data); } /** * Displays homepage. * * @return string */ public function actionSymbols() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); header('Access-Control-Allow-Headers:x-requested-with,content-type'); $data= "{\"name\":\"AAPL\",\"exchange-traded\":\"NasdaqNM\",\"exchange-listed\":\"NasdaqNM\",\"timezone\":\"America/New_York\",\"minmov\":1,\"minmov2\":0,\"pointvalue\":1,\"session\":\"0930-1630\",\"has_intraday\":false,\"has_no_volume\":false,\"description\":\"Apple Inc.\",\"type\":\"stock\",\"supported_resolutions\":[\"D\",\"2D\",\"3D\",\"W\",\"3W\",\"M\",\"6M\"],\"pricescale\":100,\"ticker\":\"AAPL\"}"; // $data= "{ // \"symbol\": [ // \"BTCUSDT\" // ], // \"description\": [ // \"BTCUSDT\" // ], // \"exchange-listed\": \"中国第一股\", // \"exchange-traded\": \"快速交易\", // \"minmov\": 1, // \"minmov2\": 0, // \"pricescale\": [ // 1 // ], // \"has-intraday\": true, // \"has_no_volume\": [ // true // ], // \"has_weekly_and_monthly\": true, // // \"has_seconds\": true, // \"has_daily\": true, // // // \"intraday_multipliers\": [ // 1 // ], // \"supported_resolutions\": [ // \"60\", // \"2D\", // \"3D\", // \"W\", // \"3W\", // \"M\", // \"6M\" // ], // // // // // // // // \"type\": [ // \"stock\" // ], // \"ticker\": [ // \"BTCUSDT\" // ], // \"timezone\": \"UTC\", // \"session-regular\": \"0900-1600\" //}"; $data="{ \"name\": \"BTCUSDT\", \"exchange-traded\": \"BTCUSDT\", \"exchange-listed\": \"BTCUSDT\", \"timezone\": \"America/New_York\", \"minmov\": 1, \"minmov2\": 0, \"pointvalue\": 1, \"session\": \"0930-1630\", \"has_intraday\": true, \"has_no_volume\": true, \"has_seconds\": true, \"description\": \"BTCUSDT\", \"type\": \"stock\", \"supported_resolutions\": [ \"1\", \"3\", \"5\", \"15\", \"30\", \"60\", \"120\", \"240\", \"360\", \"720\", \"D\", \"3D\", \"5D\", \"7D\", \"15D\", \"M\" ], \"pricescale\": 100, \"ticker\": \"BTCUSDT\" }"; echo ($data); } /** * Displays homepage. * * @return string */ public function actionTime() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); header('Access-Control-Allow-Headers:x-requested-with,content-type'); $data= "1524713662"; echo ($data); } /** * Displays homepage. * * @return string */ public function actionTimescale_marks() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); header('Access-Control-Allow-Headers:x-requested-with,content-type'); $data= "{\"name\":\"AAPL\",\"exchange-traded\":\"NasdaqNM\",\"exchange-listed\":\"NasdaqNM\",\"timezone\":\"America/New_York\",\"minmov\":1,\"minmov2\":0,\"pointvalue\":1,\"session\":\"0930-1630\",\"has_intraday\":false,\"has_no_volume\":false,\"description\":\"Apple Inc.\",\"type\":\"stock\",\"supported_resolutions\":[\"D\",\"2D\",\"3D\",\"W\",\"3W\",\"M\",\"6M\"],\"pricescale\":100,\"ticker\":\"AAPL\"}"; $data= "{ \"symbol\": [ \"BTCUSDT\" ], \"description\": [ \"BTCUSDT\" ], \"exchange-listed\": \"中国第一股\", \"exchange-traded\": \"快速交易\", \"minmov\": 1, \"minmov2\": 0, \"pricescale\": [ 1 ], \"has_intraday\": true, \"has_weekly_and_monthly\": true, \"type\": [ \"stock\" ], \"ticker\": [ \"BTCUSDT\" ], \"timezone\": \"UTC\", \"session-regular\": \"0900-1600\" }"; echo ($data); } /** * Displays homepage. * * @return string */ public function actionHistory() { header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); header('Access-Control-Allow-Headers:x-requested-with,content-type'); \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; // $params = Yii::$app->getRequest()->params; $params=Yii::$app->request->get();//获取参数 $rmap = array( '1'=>'m1', '3'=>'m3', '5'=>'m5', '15'=>'m15', '30'=>'m30', '60'=>'h1', '120'=>'h2', '240'=>'h4', '360'=>'h6', '720'=>'h12', 'D'=>'d1', '3D'=>'d3', '5D'=>'d5', '7D'=>'d7', '15D'=>'d15', 'M'=>'mo' ); $level = $rmap[$params['resolution']]; $url='http://59.110.169.112:89/kdata/'; $data = file_get_contents($url."history?symbol={$params['symbol']}&period={$level}&from={$params['from']}&to={$params['to']}"); // $data = file_get_contents($url."history?symbol=BTCUSDT&period=m1&from=1493796539&to=1493796540"); // $a=rand(1,9); // if($a > 6){ //// //// header("Access-Control-Allow-Origin: *"); //// header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); //// header('Access-Control-Allow-Headers:x-requested-with,content-type'); //// $data= "{\"t\":[1492041600,1492387200,1492473600,1492560000,1492646400,1492732800,1492992000,1493078400],\"o\":[141.91,141.48,141.41,141.88,141.22,142.44,143.5,143.91],\"h\":[142.38,141.88,142.04,142,142.92,142.68,143.95,144.9],\"l\":[141.05,140.87,141.11,140.45,141.16,141.85,143.18,143.87],\"c\":[141.05,141.83,141.2,140.68,142.44,142.27,143.64,144.54],\"v\":[17822880,16582094,14697544,17328375,23319562,17320928,17116599,18216472],\"s\":\"ok\"}"; //// // $url='http://59.110.169.112:89/kdata/'; // $data = file_put_contents($url."history?symbol={$params['symbol']}&period={$params['resolution']}&from={$params['from']}&to={$params['to']}"); // // // // // // //// }else{ // //// $data="{\"s\":\"no_data\",\"nextTime\":1522108800}"; // //// } echo ($data); } }