Basic function to access VirCurEx using Excel (VBA)

Completed Posted May 22, 2013 Paid on delivery
Completed Paid on delivery

I would like a module programmed in Excels Visual Basic Applications that will access the [url removed, login to view] API and get the balances on the account.

The way the API works is that that the parameters are passed in the URL. Refer to the following link for information.

[url removed, login to view]

The data in the link needs to be encoded using SHA2. The following example code may help. However use any other code that you can find that will perform the SHA2 function.

SHA2 VBA Script

[url removed, login to view]

The final code should look something like this. However can be changed if required. The important thing is that you program the GetBalances function to obtain the balances and return the data. The data does not need to be formatted at all, as long as I can see the data can be retrieved I can format it to my needs later on.

sub GetBalance ()

ID = ID + 1

RetData = GetBalances (SecurityWord,UserName,ID)

msgbox RetData

end sub

To answer some of the questions.
Here is cut and paste from the vircurex website

Calculation of the Token
The token is calculated by concatenating the input parameters, separated by a semi-colon and then calculating a SHA2 hash over the complete string. See the column "Token calculation" in the above function API list for the required fields that need to be included to calculate the hash.
Here an examples (in Ruby) for creating an order:


t = Time.now.gmtime.strftime("%Y-%m-%dT%H:%M:%S")
trx_id = Digest::SHA2.hexdigest("#{t}-#{rand}")
user_name = "MY_USER_NAME"
secret_word = "123456789"
tok = Digest::SHA2.hexdigest("#{secret_word};#{user_name};#{t};#{trx_id};create_order;sell;10;btc;50;nmc")
Order.call_https("https://vircurex.com","/api/create_order.json?account=#{user_name}&id=#{trx_id}&token=#{tok}&timestamp=#{t}&ordertype=sell&amount=10&currency1=btc&unitprice=50&currency2=nmc")


def self.call_https(my_url,my_params)
uri = URI.parse(my_url)
http = Net::HTTP.new(uri.host, '443')
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
response=""
resp=""
http.start do |http|
cmd = my_params
req = Net::HTTP::Get.new(cmd)
response = http.request(req)
resp = response.body
end
return ActiveSupport::JSON.decode(resp)
end

This code creates an order using the api. Essentially once any function is coded it is a simple matter to change the paramterss to access any other functions. I choose the get balances function as I thought it would be simple.

Essentially if you can convert this code from ruby to vba this is the project done.

In order to do this, Vircurex requires a reigstered user on the web site.
Once registered, select the settings option at the top left and then select API.

You need to activate the API that you want to use which involves ticking the option and then entering is a password. Once done press save and vircurex will give you a message telling you that it was sucessfull.

Visual Basic for Apps

Project ID: #4545773

About the project

3 proposals Remote project Active May 23, 2013

Awarded to:

tyrmit

I'd love to offer a solution to this project. Refer PM for details :)

$80 USD in 1 day
(1 Review)
2.0

3 freelancers are bidding on average $115 for this job

svet63

VBA developer since 1997. Well experienced with APIs, too. Regards, Svet.

$150 USD in 3 days
(4 Reviews)
4.2
CARLOSHUGGINS

Hi VBA expert here...I will deliver high quality code on short time... thanks for considering my proposal

$115 USD in 2 days
(0 Reviews)
0.0