拉贾德兰R 市场电话的创始人和联合创始人Algomojo。全职衍生品交易员。交易系统设计专家(Amibroker,Ninjatrader,Metatrader,Python,Pinescript)。自2006年以来进行市场交易。指导交易者进行交易系统设计,市场概况,订单流和交易自动化。

在Amibroker中显示天气仪表板

1分钟阅读

想将天气数据引入Amibroker。搜索免费的天气api数据。 OpenWeathermap 引起了我的注意。使用Openweathermap,您可以立即获取地球上任何位置的天气数据。

样本天气输出

{"coord":{"lon":77.6,"lat":12.98},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"base":"stations","main":
{"temp":294.15,"feels_like":297.36,"temp_min":294.15,"temp_max":294.15,"pressure":1012,"humidity":100},"visibility":6000,"wind":
{"speed":1.39,"deg":288},"clouds":{"all":75},"dt":1602971629,"sys":
{"type":1,"id":9208,"country":"IN","sunrise":1602981608,"sunset":1603024139},"timezone":19800,"id":1277333,"name":"Bengaluru","cod":200}

阿米经纪人 AFL代码获取天气仪表板

代码要求Amibroker 6.17 由于v6.17或更高版本提供了一些新的AFL功能,例如InternetClose(handle),InternetOpenURL(“ url”)和InternetReadString(handle)–从Internet资源/ http api读取时特别有用。

// Coder - 拉贾德兰R
// Founder - 市场电话.in & Co-Founder - Algomojo.com
// Algomojo Provides Free API + Free Trading Bridge for API Based Automated Trading
// Creation Date : 15th Oct 2020
// Weather Display Dashboard




_SECTION_BEGIN("Weather Display Dashboard");
Version(6.17);  //Code is Compatible with 6.17 and Higher
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", colorDefault, styleNoTitle | styleCandle | GetPriceStyle() ); 

city = ParamStr("City","Bangalore");

ih = InternetOpenURL( "http://api.openweathermap.org/data/2.5/weather?q="+city+"&appid=1f082c296a4b6013f8976bdf820147c2" );

if( ih )
{
     while( ( str = InternetReadString( ih ) ) != "" )
     {
         //printf( "%s", str );
          for( item = -1; ( sym = StrExtract( str, item,'{' )) != ""; item-- )
	 {
	 
	 if(item == -4)
	 {
	 //printf( "%s", sym );
	 
	 for( jitem = -1; ( temp = StrExtract( sym, jitem,',' )) != ""; jitem-- )
	 {
	 printf( "\n%s", temp );
	 if(Strfind(temp,"temp"))
	 {
     temp1 = StrExtract(temp,1,':');
     temp1 = StrTrim(temp1,"\"");
    //_TRACE("\nTemperature : "+NumToStr(StrToNum(temp1)-273.15) +" Degree Celsious");
	 }
	 
	 if(Strfind(temp,"feels_like"))
	 {
     fl = StrExtract(temp,1,':');
     fl = StrTrim(fl,"\"");
    //_TRACE("\nFeels Like : "+NumToStr(StrToNum(fl)-273.15)+" Degree Celsious");
	 }
	 
	 
	 if(Strfind(temp,"humidity"))
	 {
     hm = StrExtract(temp,1,':');
     hm = StrTrim(hm,"\"");
     hm = StrTrim(hm,"}");
    //_TRACE("\nHumidity : "+hm);
	 }
	 
	  if(Strfind(temp,"pressure"))
	 {
     pr = StrExtract(temp,1,':');
     pr = StrTrim(pr,"\"");

    //_TRACE("\nPressure : "+pr);
	 }
	 
	 
	 }
	 
     
     }
	 }

     }
     InternetClose( ih );
      
}

//Display Weather Dashboard

GfxSetBkMode( 0 );
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetTextColor( colorWhite );


GfxSelectPen( colorGreen, 2 ); 
GfxSelectSolidBrush( colorgreen ); 
GfxRectangle( 10, 20, 250, 180 );

GfxTextOut( "City : "+city,23,23); 
GfxTextOut( "Temperature : " +NumToStr(StrToNum(temp1)-273.15) +" °C" ,23,48); 
GfxTextOut( "Feels Like : " +NumToStr(StrToNum(fl)-273.15) +" °C",23,73);
GfxTextOut( "Humidity : " + hm+"%",23,98); 
GfxTextOut( "Pressure : " + pr+"hPa",23,123);
   
    

_SECTION_END();

现在,如果班加罗尔的天气超过摄氏30度,我绝对不会做空Nifty Futures!

拉贾德兰R 市场电话的创始人和联合创始人Algomojo。全职衍生品交易员。交易系统设计专家(Amibroker,Ninjatrader,Metatrader,Python,Pinescript)。自2006年以来进行市场交易。指导交易者进行交易系统设计,市场概况,订单流和交易自动化。

什么是QuantZilla?

Quantzilla是75个小时以上的代码指导程序,专为希望从设计指标,扫描仪,交易...
拉贾德兰R
读取58秒

建立括号订单执行时要考虑的事项…

我们从大多数algomojo交易员那里得到了最迫切的需求,即制定框架定单策略。本文介绍了...的列表
拉贾德兰R
12分钟阅读

下订单–Amibroker的多经纪人Exectuion代码段

本教程说明了如何从头开始构建按钮交易,以及单击按钮如何发送订单...
拉贾德兰R
7分钟阅读

发表评论

获取通知,市场更新警报,交易工具,自动化等