bloomberg api server? - api

looking at bloomberg api
http://www.openbloomberg.com/
and downloaded example code, looks we need some server to get the data?
private void run(String[] args) throws Exception
{
String serverHost = "127.0.0.1";
int serverPort = 8194;
String serviceName = "//blp/mktdata";
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.setServerHost(serverHost);
sessionOptions.setServerPort(serverPort);
are the servers freely available or we need to buy that?
if not, this means we still do not have a open free data (either live or historical?)
thx.

127.0.0.1" is your local machine and you need to have a Bloomberg terminal open & logged on (=> you need to be a subscriber, which is chargeable).
The only thing that is "free" is the API, which has been open sourced. But the data remains proprietary, whether it's live or historical.

There's relevant information in this SO post. Specifically user2023861 offers a project Bloomberg API Emulator which you might find useful. I haven't tried it. Bloomberg, in response to a question sent to open-tech#bloomberg.net, has announced a plan to release their own emulator later this month. The intention to do this is mentioned here in the response to question 7.

You can access some data from the bloomberg website, e.g. historical data on investment funds. It's not an officially released API so my change in the future, but for now it's working. Here you can find a simple example to download yearly time series.

Related

Discord bot doesn't show emotes from other servers in embeds

I'm working on a Discord bot using Discord.Net 2.2.0 and written in VB.NET. One of the (overly-ambitious?) many features of my bot will be posting player data from the mobile game, Star Wars: Galaxy of Heroes into an embed. This includes certain character ability information in which I wish to include some emotes to make it a bit more aesthetically pleasing. Initially, I had uploaded the emotes to a server I was testing in and everything worked great:
However, I realized that, if my bot makes it out into the wild, I can't really be installing these emotes on every server out there. I'm still in the beginning stages of this project, and I foresee the need for several "custom" emotes for some of the embeds I'll be using. So, I decided to create a new Discord server (henceforth referred to as the bot's "home" server) in which to load these emotes for use in the "client" or "target" server.
Unfortunately, when I try to include emotes from the bot's home server in the embed, all I get are the emote names and no images:
After fighting with it a bit, I tried including emotes from both servers in the same embed and I get "mixed" results. Those emotes that I include which are loaded in the client/target server show up correctly, but those that are from the bot's home server only display the emote name:
The method is pretty long, so here's a very simplified example of the code I'm using to create the embeds:
Dim BotHomeServer As Discord.WebSocket.SocketGuild = BotClient.GetGuild(Convert.ToUInt64(HOME_SERVER_ID))
Dim TargetServer As Discord.WebSocket.SocketGuild = BotClient.GetGuild(Convert.ToUInt64(TARGET_SERVER_ID))
Dim PostingChannel As Discord.WebSocket.SocketTextChannel = TargetServer.GetTextChannel(Convert.ToUInt64(POST_CHANNEL_ID))
Dim HomeEmote As Discord.Emote = Await BotHomeServer.GetEmoteAsync(EMOTE_ID_FROM_HOME_SERVER)
Dim TargetEmote As Discord.Emote = Await TargetServer.GetEmoteAsync(EMOTE_ID_FROM_TARGET_SERVER)
Dim PostBuilder As New Discord.EmbedBuilder
'... other fields and properties of the embed
PostBuilder.AddField("Home Server Test", "Some Text Here <:" & HomeEmote.Name & ":" & HomeEmote.Id & ">", False)
PostBuilder.AddField("Target Server Test", "Some Text Here <:" & TargetEmote.Name & ":" & TargetEmote.Id & ">", False)
'... other fields and properties of the embed
Await PostingChannel.SendMessageAsync("This is a test", False, PostBuilder.Build)
I've also tried using the .ToString() method for adding the emotes to the embed instead of "manually" building them with the Name and Id properties, but I get the exact same results. I retrieved the emote ID's by typing \:emotename: in the home (and client/target) server. The emote names (i.e., :gohomega:) are correct, so I know that it's correctly finding the emote in the bot's home server. It's just not displaying them unless they're loaded in the client/target server.
I found a similar issue addressed in the question, Discord bot can't show emote “sometimes”. Although the issue reported there is definitely different, the end result - the emote names showing up instead of the actual image - is the same behavior I'm trying to troubleshoot. The fact that the issue in that question is sporadic (whereas my issue is consistent) and that the bot there is written in a different language (Node.js instead of a .NET language) and using different libraries (I assume) has me wondering if the issue may be on Discord's end rather than anything to do with my code.
I've triple- and quadruple-checked that the bot (and the role group it's in) have permission to use external emojis on the client/target server:
Initially, I had forgotten this bit and it didn't have the appropriate permissions. However, even after granting the necessary permissions, I still get the same results.
At this point, I'm not above admitting that I may just be overlooking/missing something, or simply being dense about what I'm looking at, but I'm wondering if anyone else has encountered (and hopefully resolved) this particular issue with a bot using emotes from a different server.
EDIT
Just to make certain, I stepped through the code in my IDE and checked the properties of one of the emotes at the time it's supposedly being added to the embed:
The emote's Id and Url properties appear to be correct, but I also went ahead and "validated" the Url property with my browser and verified that it does show the correct image for the emote.
Per the comments, the bot is a member of both servers:
I'm grasping at straws here, but perhaps it has something to do with the fact that the "home" server is so new (I just created it last night)? I mean, Discord's documentation says this should work, and the Discord.Net documentation basically says the same thing. According to the comments, it works for other people and my code looks "right", so it's really leading me to believe the entire issue is something on Discord's end.
I've also asked this question in both the Discord API server (#dotnet_discord-net) and the Discord Bots server (#development), so feel free to join me in one of those servers for an "extended conversation", if needed.
Okay, I finally found the cause of the issue, and I feel like a moron. I spent all my time looking at the bot's permissions and the group permissions at the server level, but I didn't even think about the actual channel permissions. The Use External Emoji permission for bot's group role in the channel was set to inherit:
I set it to allow and, voilà, the emotes came through just fine. I checked the permissions for the category that the text channel is in and found that the bot/group roles weren't even listed. I guess I had mistakenly assumed that the bot/group role permissions for the channel would get inherited from the server-level permissions I had set, even though the message at the top of the channel's permission screen explicitly states that the permissions are synced with the category.
The moral of the story? If it looks like a permission issue, don't forget to look at ALL of the permissions at every level.
Server
Category
Channel

Are there any API services that allow me to send a Bitcoin transaction with OP_RETURN?

I want to be able to send the minimum amount of Bitcoin required in order to write a 40 byte (roughly 80 character) message via ideally a REST API allowing me to specify a bitcoin wallet private key, the recipient bitcoin address, the fee and the message to attach to the OP_RETURN.
Thank you!
--
I wish Bitcoin allowed you to send coins without having to have an API or daemon - through http somehow would be cool. How would I create a raw transaction with a OP_RETURN in it to push to an API /tx/push using php and curl?
There are more options as the OP_RETURN protocol is so simple but here are the ones I recommend:
1. Blockcypher
Blockcypher API has a Data endpoint to write op return transaction but you need to register an API token with them so it's not completely under your control (they can ban your token), it supports only 40 bytes not 80 (well 75 in reality) but it's free, which is awesome!
Check it out (mainchain):
https://www.blockcypher.com/dev/bitcoin/#data-endpoint
Example from their doc (curl):
# Embedding String Data
curl -d '{"data":"I am the walrus", "encoding":"string"}' https://api.blockcypher.com/v1/btc/main/txs/data?token=YOURTOKEN
{
"data": "I am the walrus",
"encoding": "string",
"token": "YOURTOKEN",
"hash": "cb6974e0fd57c91b70403e85ef48c840eecdca4804dfc4897b1321d5328e4f18"
}
2. BlockchainPen
If you're searching for an APP (maybe to test quickly) or to get some open source code and modify it to your needs there's BlockchainPen:
http://blockchainpen.com
This is not an API service but more a webapp. It has a client-side browser wallet where you can load some funds (1mbtc?) and write op-return messages.
Click on the address to get a QR for loading funds quickly from a mobile wallet - The UI is very basic, you need to refresh the page to see the updated balance - The funds are yours, you can export your private key at any time (check the link at the bottom of the page).
The code is open source so you could import and use the Pen class (coffeescript or js version) in your programs to write transaction via nodejs: https://github.com/makevoid/blockchain-pen/blob/master/pen.coffee
Or with something like phantomJS, selenium/webdriver or some other browser automation tool you could use the deployed version but I think it will not be clean.
There are two currently open source implementation of blockchain-pen:
1: https://github.com/makevoid/blockchain-pen (latest)
2: https://github.com/makevoid/blockchain_pen (old repo - js / ruby opal)
You can also change the fee depending on your needs, the default one is 0.1mbtc, on http://prio.blockchainpen.com (priority) is 0.3mbtc.
(p.s. disclamer: I'm the developer behind this, feel free to fork/improve the project, a new and simpler version will be released in 2017)
You can use http://www.stamping.io you can anchored a transaction in Bitcoin & Ethereum in the same time. Try it!

OAuth2 w/ Google Client API 1.8.1

I have been using the Google Client API in a .NET web application - but need to update to the latest version (both to use the most recent code but also to lose the need for the DotNetOpenAuth.dll.) The latest version (1.8.1) has a totally redesigned OAuth interface (using google.apis.auth) and I can't seem to even get started w/ it.
Previously I had written code that handled generating an AuthorizationURL (as needed) and creating IAuthenticator and IAuthorizationState objects - storing the refresh token in a sql database as needed. I was also about to retrieve "UserInfo" about the user as needed (once authenticated.)
Now - I'm unclear on how to handle the generation of the AuthURL (do I have to do it 100% manually?) and how/what I need to pass to the BaseClientService.Initializer when working w/ client API (such as Google Drive.)
Also - previously I wrote methods to "store" and "retrieve" credentials from the database - now it seems I would need to write a class based on IDataStore? But I'm not sure if this is even correct (let alone find a decent sample/doc anywhere.)
Finally - it doesn't seem like google.apis.auth handles anything w/ regards to UserInfo - I have to grab google.apis.oauth2 - but that .dll has even LESS documentation/sample code out there.
Any advice on where to start? The google.apis sample code seems decent for performing basic api tasks but all the Oauth2 information is very basic, uses file data storage and seems glossed over.
Thanks!
First of all, take a look at https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth. All the documentation that you might need is there, and if something is missing let us know!
You are right, you already have an implementation of FileDataStore, and we are planning to create EFDataStore as well for the next release.

Downloading YouTube video information, used to work, now not so much

I used to have some code for downloading youtube data and processing it and everything worked fine until google changed something. Was around the time they changed it from 1 channel per account to as many as you want.
This is a sample of the feed that I would download and process but I can’t seem to get it working.
feedUrl = http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads
The code I would use to process it looks like this;
Dim videoFeed As Feed(Of Video) = request.[Get](Of Video)(New Uri(feedUrl))
In the references section, I used to have v2.1 of the google.GData.YouTube, .Extensions & .Client addons and I have updated them to 2.2.
I tried changing the code that processes the line to this but it still doesn’t work.
Dim videoFeed As Feed(Of Google.YouTube.Video) = request.[Get](Of Google.YouTube.Video)(New Uri(feedUrl))
The code runs over the line ok, it’s when it tries to use videoFeed, it throws the error.
intTotalVideos = videoFeed.TotalResults
The error I get is as follows;
Execution of request failed: http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads
I don’t know what changed on the google side, maybe it was the new v3 API or the way you log in via code changed when they let you have multiple channels per account.
If anyone has any advice or where I can find more information, it would be greatly appreciated.
(I tried to find the original code on the net that I used to create the project but was unable to find it sorry.)
According to Developer's Guide: .NET:
The YouTube Data API (v2) has been officially deprecated as of March
4, 2014. Please refer to our deprecation policy for more information.
The following V2 example works for me:
Dim settings As New YouTubeRequestSettings(applicationName, developerKey)
Dim request As New YouTubeRequest(settings)
Dim videoFeed As Feed(Of Video) = request.[Get](Of Video)(New Uri(feedUrl))
Dim intTotalVideos As Integer = videoFeed.TotalResults
Google YouTube SDK .Net Library with version 2.2.0 is used.

Using JSON to update app's content in iOS

I'm about to create an application that uses JSON to update its content.
This is how I planned it to work:
When application starts, it checks (with internet connection is available) if the JSON file set on remote server is newer than the one stored localy - if it is then it's downloaded.
Then, the application applies data from that JSON to the content. For example, to the "Contact" information - it applies data like phone numbers etc.
My question is, is it in your opinion, a good technique to update appliactions content?
Does anynone had an experience with building app with this kind of idea?
Best regards,
Zin
Of course you can do this. One thing that may lead to a better user experience would be to ask the user for his permission to download new content (if there is something new).
This is a normal thing to do. I have a phonebook app that does exactly this. On a side note, if you need a network class to handle the web-service interaction, see this SO post. I wrote a custom network class that works with AFNetworking.