Ally Invest (TradeKing)
Interact with the Ally Invest API (formerly TradeKing) using SQL Server
- Install the SQLHTTP database on your SQL Server
- Obtain a Consumer Key, Consumer Secret, Token and Token Secret from Ally Financial
- Create the stored procedures documented below
- Execute the following SQL statement:
1 2 3 4 5 6 |
EXEC usp_AllyInvest_Auth_Init @ConsumerKey = 'your-ally-invest-consumer-key', @ConsumerSecret = 'your-ally-invest-consumer-secret', @Token = 'your-ally-invest-token-here', @TokenSecret = 'your-ally-invest-token-secret' |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
CREATE PROCEDURE usp_AllyInvest_Auth_Init( @ConsumerKey varchar(4000), @ConsumerSecret varchar(4000), @Token varchar(4000), @TokenSecret varchar(4000)) AS SET NOCOUNT ON EXEC SQLHTTP.net.AuthParamSet @Profile = 'TradeKing', @Name = 'ConsumerKey', @Value = @ConsumerKey EXEC SQLHTTP.net.AuthParamSet @Profile = 'TradeKing', @Name = 'ConsumerSecret', @Value = @ConsumerSecret EXEC SQLHTTP.net.AuthParamSet @Profile = 'TradeKing', @Name = 'Token', @Value = @Token EXEC SQLHTTP.net.AuthParamSet @Profile = 'TradeKing', @Name = 'TokenSecret', @Value = @TokenSecret GO |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
CREATE PROCEDURE usp_AllyInvest_Auth_Header( @HttpSessionID uniqueidentifier, @URL varchar(4000), @Method varchar(10)) AS DECLARE @ConsumerKey varchar(4000) DECLARE @ConsumerSecret varchar(4000) DECLARE @Token varchar(4000) DECLARE @TokenSecret varchar(4000) SET @ConsumerKey = SQLHTTP.net.AuthParam('TradeKing', 'ConsumerKey') SET @ConsumerSecret = SQLHTTP.net.AuthParam('TradeKing', 'ConsumerSecret') SET @Token = SQLHTTP.net.AuthParam('TradeKing', 'Token') SET @TokenSecret = SQLHTTP.net.AuthParam('TradeKing', 'TokenSecret') EXEC SQLHTTP.net.OAuthHeader @HttpSessionID = @HttpSessionID, @URL = @URL, @Method = @Method, @ConsumerKey = @ConsumerKey, @ConsumerSecret = @ConsumerSecret, @Token = @Token, @TokenSecret = @TokenSecret GO |
IMPORTANT DISCLAIMER
CODE/SQL ON THESE PAGES ARE PROVIDED AS-IS AND ARE AVAILABLE FOR ILLUSTRATIVE PURPOSES ONLY.
USERS ARE REQUIRED TO ABIDE BY THE TERMS AND CONDITIONS FOR USING REFERENCED THIRD PARTY WEBSITES AND/OR APIs FROM THEIR RESPECTIVE WEBSITES. WE DO NOT CONDONE ANY VIOLATION OF THIRD PARTY WEBSITES AND/OR APIs TERMS AND CONDITIONS USING OUR SOFTWARE.
USERS SHALL BE SOLELY RESPONSIBLE AND BE SOLELY LIABLE FOR VIOLATION OF ANY RULES SPECIFIED BY THIRD PARTIES FOR USING THEIR WEBSITES AND/OR APIs, OR INFRINGEMENT OF RIGHTS OF SUCH THIRD PARTIES.