• sgiuliani
  • Moderator
  • Posts 5
  • Reputation 5
  • Member Since
  • Last Active
    This user has not added any photos yet.
All Posts Topics Started Likes
Alpha Vantage .NET Wrapper - Avapi
A new version of Avapi came out today!
https://www.nuget.org/packages/Avapi/1.4.7.8 

There is now the possibility to perform Asynchronous Request:
Code:

    ...
    public partial class Form1 : Form
    {
        private IAvapiConnection m_connection = AvapiConnection.Instance;
        private Int_TIME_SERIES_INTRADAY m_time_series_intraday;
        private IAvapiResponse_TIME_SERIES_INTRADAY m_time_series_intradayResponse;
        ...
        protected override void OnLoad(EventArgs e)
        {
            // Set up the connection and pass the API_KEY provided by   alphavantage.co  
            m_connection.Connect("Your Alpha Vantage Key");

            // Get the TIME_SERIES_INTRADAY query object
            m_time_series_intraday = m_connection.GetQueryObject_TIME_SERIES_INTRADAY();

            base.OnLoad(e);
        }
        private async void TIME_SERIES_INTRADAYAsyncButton_Click(object sender, EventArgs e)
        {
            // Perform the TIME_SERIES_INTRADAY request and get the result
            m_time_series_intradayResponse = 
                await m_time_series_intraday.QueryAsync(
                     "MSFT",
                     Const_TIME_SERIES_INTRADAY.TIME_SERIES_INTRADAY_interval.n_1min,
                     Const_TIME_SERIES_INTRADAY.TIME_SERIES_INTRADAY_outputsize.compact,
                     Const_TIME_SERIES_INTRADAY.TIME_SERIES_INTRADAY_datatype.json);

             // Show the results
            resultTextBox.AppendText("******** RAW DATA TIME_SERIES_INTRADAY ********" + "\n");
            resultTextBox.AppendText(m_time_series_intradayResponse.RawData + "\n");
            resultTextBox.AppendText("******** STRUCTURED DATA TIME_SERIES_INTRADAY ********" + "\n");

            var data = m_time_series_intradayResponse.Data;
            if (data.Error)
            {
                resultTextBox.AppendText(data.ErrorMessage + "\n");
            }
            else
            {
                resultTextBox.AppendText("Information: " + data.MetaData.Information + "\n");
                resultTextBox.AppendText("Symbol: " + data.MetaData.Symbol + "\n");
                resultTextBox.AppendText("LastRefreshed: " + data.MetaData.LastRefreshed + "\n");
                resultTextBox.AppendText("Interval: " + data.MetaData.Interval + "\n");
                resultTextBox.AppendText("OutputSize: " + data.MetaData.OutputSize + "\n");
                resultTextBox.AppendText("TimeZone: " + data.MetaData.TimeZone + "\n");
                resultTextBox.AppendText("========================" + "\n");
                resultTextBox.AppendText("========================" + "\n");
                foreach (var timeseries in data.TimeSeries)
                {
                    resultTextBox.AppendText("open: " + timeseries.open + "\n");
                    resultTextBox.AppendText("high: " + timeseries.high + "\n");
                    resultTextBox.AppendText("low: " + timeseries.low + "\n");
                    resultTextBox.AppendText("close: " + timeseries.close + "\n");
                    resultTextBox.AppendText("volume: " + timeseries.volume + "\n");
                    resultTextBox.AppendText("DateTime: " + timeseries.DateTime + "\n");
                    resultTextBox.AppendText("========================" + "\n");
                }
            }
        }
    }
1 0
Alpha Vantage .NET Wrapper - Avapi
Hi everyone,

We have created a wrapper for Alpha Vantage targeting .NET Core and .NET Standard: its name is Avapi.

Nuget Repository: https://www.nuget.org/packages/Avapi/
Official page: https://github.com/AvapiDotNet/Avapi/
Complete documentation: https://github.com/AvapiDotNet/Avapi/wiki
1 0
Alpha Vantage .NET Wrapper - Avapi
A new version of Avapi came out today!
https://www.nuget.org/packages/Avapi/1.4.7.8

There is now the possibility to perform Asynchronous Request:

Code:

using Avapi;
using Avapi.AvapiTIME_SERIES_INTRADAY
using System;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        private IAvapiConnection m_connection = AvapiConnection.Instance;
        private Int_TIME_SERIES_INTRADAY m_time_series_intraday;
        private IAvapiResponse_TIME_SERIES_INTRADAY m_time_series_intradayResponse;
        public Form1()
        {
            InitializeComponent();
        }
        protected override void OnLoad(EventArgs e)
        {
            // Set up the connection and pass the API_KEY provided by  alphavantage.co
            m_connection.Connect("Your Alpha Vantage Key");
            // Get the TIME_SERIES_INTRADAY query object
            m_time_series_intraday = m_connection.GetQueryObject_TIME_SERIES_INTRADAY();
            base.OnLoad(e);
        }
        private async void TIME_SERIES_INTRADAYAsyncButton_Click(object sender, EventArgs e)
        {
            // Perform the TIME_SERIES_INTRADAY request and get the result
            m_time_series_intradayResponse = 
                await m_time_series_intraday.QueryAsync(
                     "MSFT",
                     Const_TIME_SERIES_INTRADAY.TIME_SERIES_INTRADAY_interval.n_1min,
                     Const_TIME_SERIES_INTRADAY.TIME_SERIES_INTRADAY_outputsize.compact,
                     Const_TIME_SERIES_INTRADAY.TIME_SERIES_INTRADAY_datatype.json);
             // Show the results
            resultTextBox.AppendText("******** RAW DATA TIME_SERIES_INTRADAY ********" + "\n");
            resultTextBox.AppendText(m_time_series_intradayResponse.RawData + "\n");
            resultTextBox.AppendText("******** STRUCTURED DATA TIME_SERIES_INTRADAY ********" + "\n");
            var data = m_time_series_intradayResponse.Data;
            if (data.Error)
            {
                resultTextBox.AppendText(data.ErrorMessage + "\n");
            }
            else
            {
                resultTextBox.AppendText("Information: " + data.MetaData.Information + "\n");
                resultTextBox.AppendText("Symbol: " + data.MetaData.Symbol + "\n");
                resultTextBox.AppendText("LastRefreshed: " + data.MetaData.LastRefreshed + "\n");
                resultTextBox.AppendText("Interval: " + data.MetaData.Interval + "\n");
                resultTextBox.AppendText("OutputSize: " + data.MetaData.OutputSize + "\n");
                resultTextBox.AppendText("TimeZone: " + data.MetaData.TimeZone + "\n");
                resultTextBox.AppendText("========================" + "\n");
                resultTextBox.AppendText("========================" + "\n");
                foreach (var timeseries in data.TimeSeries)
                {
                    resultTextBox.AppendText("open: " + timeseries.open + "\n");
                    resultTextBox.AppendText("high: " + timeseries.high + "\n");
                    resultTextBox.AppendText("low: " + timeseries.low + "\n");
                    resultTextBox.AppendText("close: " + timeseries.close + "\n");
                    resultTextBox.AppendText("volume: " + timeseries.volume + "\n");
                    resultTextBox.AppendText("DateTime: " + timeseries.DateTime + "\n");
                    resultTextBox.AppendText("========================" + "\n");
                }
            }
        }
    }
}


0 0
Alpha Vantage .NET Wrapper - Avapi
alphavantageforum wrote:
Thanks for the great post! Do you mind posting some sample code snippets to the ASP.NET section as well? 


Yup I will soon
0 0
Alpha Vantage .NET Wrapper - Avapi
Hi everyone,

We have created a wrapper for Alpha Vantage targeting .NET Core and .NET Standard: its name is Avapi.

Nuget Repository: https://www.nuget.org/packages/Avapi/
Official page: https://github.com/AvapiDotNet/Avapi/
Complete documentation: https://github.com/AvapiDotNet/Avapi/wiki

E.g.: Below a complete code snippet to consume the TIME_SERIES_DAILY operation.


Code:

using System;
using System.IO;
using Avapi.AvapiTIME_SERIES_DAILY;

namespace Avapi
{
    public class Example
    {
        static void Main()
        {
            // Creating the connection object
            IAvapiConnection connection = AvapiConnection.Instance;

            // Set up the connection and pass the API_KEY provided by alphavantage.co
            connection.Connect("Your Alpha Vantage API Key !!!!");

            // Get the TIME_SERIES_DAILY query object
            Int_TIME_SERIES_DAILY time_series_daily =
            connection.GetQueryObject_TIME_SERIES_DAILY();

            // Perform the TIME_SERIES_DAILY request and get the result
            IAvapiResponse_TIME_SERIES_DAILY time_series_dailyResponse =
                time_series_daily.Query(
                "MSFT",
                Const_TIME_SERIES_DAILY.TIME_SERIES_DAILY_outputsize.compact,
                Const_TIME_SERIES_DAILY.TIME_SERIES_DAILY_datatype.json);

            // Printout the results
            Console.WriteLine("******** RAW DATA TIME_SERIES_DAILY ********");
            Console.WriteLine(time_series_dailyResponse.RawData);

            Console.WriteLine("******** STRUCTURED DATA TIME_SERIES_DAILY ********");
            var data = time_series_dailyResponse.Data;
            if (data.Error)
            {
                Console.WriteLine(data.ErrorMessage);
            }
            else
            {
                Console.WriteLine("Information: " + data.MetaData.Information);
                Console.WriteLine("Symbol: " + data.MetaData.Symbol);
                Console.WriteLine("LastRefreshed: " + data.MetaData.LastRefreshed);
                Console.WriteLine("OutputSize: " + data.MetaData.OutputSize);
                Console.WriteLine("TimeZone: " + data.MetaData.TimeZone);
                Console.WriteLine("========================");
                Console.WriteLine("========================");
                foreach (var timeseries in data.TimeSeries)
                {
                    Console.WriteLine("open: " + timeseries.open);
                    Console.WriteLine("high: " + timeseries.high);
                    Console.WriteLine("low: " + timeseries.low);
                    Console.WriteLine("close: " + timeseries.close);
                    Console.WriteLine("volume: " + timeseries.volume);
                    Console.WriteLine("DateTime: " + timeseries.DateTime);
                    Console.WriteLine("========================");
                }
            }
        }
    }
}
3 0
count post selected

Add a Website Forum to your website.