Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers Pending Deletion PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


Syntax


public TextSentiment AlchemyAPIClient.GetRank(string text, string yourAlchemyAPIKey)

int TextSentiment.Type: -1 (negative), 1 (positive) double TextSentiment.Score: sentiment rank expressed as a value of type double

Parameter Description

textSome text to apply AlchemyAPI's sentiment analysis on
yourAlchemyAPIKeyYour AlchemyAPI key sequence

Description

Image

The AlchemyAPIClient is powered by AlchemyAPI. AlchemyAPI provides natural language processing ability.

To use the AlchemyAPIClient, you need to register for your own AlchemyAPI key here:

Example

The following example illustrates sentiment analysis (powered by AlchemyAPI) on a list of twits for current symbol obtained from StockTwits:


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using Community.Components; /*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions ***/

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { const string key = ""; // GET A FREE API KEY FROM alchemyapi.com AND INSERT YOUR KEY HERE protected override void Execute() { if( key.Length == 0 ) { System.Windows.Forms.MessageBox.Show( "Get an API key before using" ); Abort(); } List<string> lst = StockTwitsClient.GetStockTwits( Bars.Symbol ); if( lst.Count < 1 ) return; foreach( string s in lst ) { TextSentiment ts = AlchemyAPIClient.GetRank( s, key ); PrintDebug( s + Environment.NewLine + ts.Type.ToString() + "\t" + ts.Score.ToString() ); FlushDebug(); } } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.