validate OCC option symbol through Bloomberg data licence - api

I am receiving OCC option symbols from the thirdparties. I need to validate the OCC option symbol from Bloomberg data licence.
Can we validate the OCC symbol from Bloomberg without the need to knowing the yellowKey/market sector.

The OCC option symbol consists of 4 parts:
Root symbol of the underlying stock or ETF, padded with spaces to 6 characters
Expiration date, 6 digits in the format yymmdd
Option type, either P or C, for put or call
Strike price, as the price x 1000, front padded with 0s to 8 digits
So you can write a function and effectively parse each token based on the index and validate from a valid symbol perspective. But it is possible the given PUT or CALL might not exist in the market.
Refer to the following link for more information.
https://en.wikipedia.org/wiki/Option_symbol

Related

Empty array returned when calling AlphaVantage APIs for NASDAQ tickers

I cannot get any NASDAQ data from the Alpha Vantage TIME_SERIES_DAILY, TIME_SERIES_DAILY_ADJUSTED or TIME_SERIES_INTRADAY -- the returned array is always empty regardless of the equity or index symbol I use:
{}
This is the call I made to get that array:
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=NASDAQ:^IXIC&interval=15min
Notice I've used the NASDAQ: prefix. I've also tried using NSQ: instead -- with exactly the same results. I don't get this issue when calling for LSE (LON:) or NYSE (NYSE:) data.
I've tried a range of valid and invalid equity ticker symbols (e.g. GOOGL, MSFT) with either the same empty array result returned (if a valid ticker) or an expected error message returned (if an invalid ticker).
Am I doing something wrong here? Is NASDAQ listed using some other random collection of letters?
I've noticed some inconsistency between real-life ticker symbols, and the AV ticker symbols -- often enough that I've created a translation table so I can represent domain-useful information rather than AV-useful information. I'm hoping I'm just using an incorrect or outdated reference to NASDAQ to call the API.
Your help is much appreciated in advance!
TLDR;
Just look up the symbol (ie. AAPL or GOOGL). The IXIC is an index, Alpha Vantage currently does not cover indexes.
Further notes:
Quotes from Alpha Vantage are aggregated, so any price you're getting won't be the price from what it's traded on the NASDAQ, but a quote of what the price is across exchanges.
If you're looking for a specific symbol, you can check for what it's listed as using the search endpoint.
Example here

Using and displaying more than 2 decimal places

I want to use more than 2 decimal places to make calculations with my MS Project project.
So far i wasn't able to find any resource which tells how to show more than 2 decimal in a field (like Work or cost, for example), neither how to truncate numbers instead of rounding them (lets say, USD 12.357 to USD 12.35 instead of USD 12.36).
Is there any way of doing this? It could be through VBA or any method you can come up with.
You can use more than 2 decimal places, just not in the user interface.
The UI truncates displayed and entered values to 2 decimals. However, values entered and accessed via VBA do not have this limitation.
For example, using the Intermediate window (VBA), enter the cost for the first two tasks of the active project and then request the values to prove they are stored as entered, up to 16 digits:
ActiveProject.Tasks(1).Cost = 0.1234567890123456789
ActiveProject.Tasks(2).Cost = 123456789012.123456789
? ActiveProject.Tasks(1).Cost
0.123456789012346
? ActiveProject.Tasks(2).Cost
123456789012.123
To show the value in the UI as stored, customize a text field using the Format function:

Converting SQL statement to Regular Expression - can it be done?

I need to convert the below SQL statement into Regular Expression.
CASE WHEN TypeCode >= 400
AND TypeCode < 700
THEN Amt * -1
ELSE Amt
END
Background: I am putting a bank transactions file (BAI2 file) in to a system for transactional matching (matching bank transactions to GL transactions). In order to get these transactions to match, the fields to match on have to be exactly the same. However, in the GL a $500 check may be input as -500 (because the company's cash account is being reduced by $500 for a utility bill), but BAI files store all amounts as positive values. I need to use the transaction type code from the bank to identify whether an amount should be a debit or a credit (in reference to the GL).
I have SQL developers that can do this using SQL, but this tool I'm using to do the BAI data manipulation requires the logic to be input as Regular Expression.
Can anyone assist in applying the appropriate signage (positive or negative) to these amounts for bank transactions? Can this even be done? I'm a new poster so please bear with any ignorance and let me know if I can provide further details/information.
Maybe try this:
^[4-6][0-9]{2}$
This will look for numbers between 400-699 inclusive.
EDIT: Changed \d to [0-9] as \d may include weird characters as well.
I feel your pain...no bank makes it easy.
'\d' means exactly '[0-9]', '\d' is shorter.
Banks have done a good job at fooling the masses that the word 'credit' is good and 'debit' is bad (me thinks that is their intent...).
You can't know if the value should be negative or positive unless you KNOW which direction the money is flowing in.
IF the table has separate columns for INWARDS/RECEIVED funds and OUTWARDS/PAID funds, then you do not need positive and negative indication.
IF, however, there is only ONE column in the table for all AMOUNTS, whether moved INTO or taken OUT FROM the account, then you definitely need SIGNED VALUES (positive/negative indication).
Either "-$nnn" or "($nnn)", with or without the "$".
If you have TWO COLUMN tables (PAID IN and PAID OUT) then just use "$nnn" without SIGNS.
If you have a SINGLE COLUMN table, then you can replace "$" with "-$" using:
$value =~ s/\$/-\$/;
The above is a perl example.
'\$' means "literal SIGIL" (i.e. dollar sign).
To match any value between and including 399-700 use the following regex:
^(399|[4-6]\d\d|700)$
That should match exactly what you want.
So you could do something like (in perl):
if ($TypeCode =~ m/^([4-6]\d\d|399|700)$/) { # if code matches pattern
# -EITHER-
$Amount=~ s/\$/-\$/; # prepend "-" to "$"
# -OR-
$Amount=~ s/\$/-/; # replace "$" with "-"
}
The '^' (carat - start of line or string) and '$' (sigil - end of line or string) surrounding the regex stop it from matching anything with 4 or more digits, like 3399 or 47421.
I moved '[4-6]\d\d' to the front as that will match 300 of 302 possible codes (and, I dunno, it may save a few milliseconds of processing).
'[4-6]' = '[456]', which means the digits from '4' to '6'.
TEST THIS ON SAMPLE DATA FIRST!

How to affix a pound sign (£) to decimal (VB.NET)

Initially there was an issue of lexicographic-ordering which caused a column of currency values to be sorted as string.
In order to sort a column of values within VB as currency this following code is utilised: m_dtTemp.Columns("P/O Value").DataType = GetType(Decimal)
which works absolutely fine, the problem now is the lack of pound sign (£) affixed to the values.
I can't see a method to include a pound sign without resorting back to type string, thus taking me back to square one. The overall goal is to retain the numerical sort functionality whilst an addition of a pound sign is affixed to the values.

"Error validating Name:Invalid string." When Adding Customer

I receive this error when adding a QBO Customer with a name that has greater/less than characters ('>', '<'). I've looked through the documentation and can't find a lit of unacceptable characters. How do I know what is and is not acceptable? I just need to know what to look for to sanitize our local data before uploading.
The API is XML-based, right? That means you need to either escape the characters into ">" and "<" respectively, probably with a standard library available in your environment; or filter the 5 characters listed here.