Introduction

Macrobond offers an API that can be used in Python for Windows.

Requirements

The API is included in Macrobond 1.15.88 and later versions. The Macrobond API has been tested with Python 2.7.11 and 3.6.1 which can be downloaded here as well as Anaconda 4.3.1 with Python 3.6 that can be found here. If you are running the 64-bit version of Python, you need to use the 64-bit version of Macrobond. This is a COM API and requires the pywin32 extension found here. We have tested with pywin32 b220.

NB! Due to an issue with pywin32 b220 you must not use the "makepy" or win32com.client.gencache.EnsureModule features of pywin32 on the type of the Macrobond API.

This document refers to Macrobond 1.15.88 and later.

Interfaces

The documentation of the interfaces uses a "c" style syntax which includes the type information for parameters and return values.

The special type VARIANT is used when several data types are accepted which is then explained in the text.

[] is used to denote a list. For instance, ISeries[] is a list of ISeries objects.

In the examples below a class called constants defines all the constants used in the example. It is declared here.

IConnection

All interaction with the Macrobond starts with an instance of the Connection object which is access through the IConnection interface. You create an instance of the object like this:

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")

The interface contains the following methods and properties:

IDatabase Database This property returns a reference to the database interface.
Close() Call this method if you want to free all resources used by the Macrobond API. Opening and closing sessions can be slow, so it is usually not a good idea to open and close them for each request.

IDatabase

This interface allows you to interact with the Macrobond database.

ISeries FetchOneSeries(string seriesName) Download one series from the database.
ISeries[] FetchSeries(VARIANT seriesNames) Download one or more series from the database. The parameter can be a string, a vector of series names or an object created by CreateUnifiedSeriesRequest(). The result is a vector of series in the same order as requested.
IEntity FetchOneEntity(string entityName) Download an entity, such as a Release.
IEntity[] FetchEntities(VARIANT entityNames) Download one or more entities from the database. The parameter can be a string or a list of entity names. The result is a vector of entities in the same order as requested.
ISeriesRequest CreateUnifiedSeriesRequest() Create a request of one or more series where the resulting time series will be converted to a common length and calendar. You can specify frequency, currency, date range, missing value and frequency conversion methods
ISeries CreateSeriesObject(string name, string description, string region, string category, SeriesFrequency frequency, SeriesWeekdays dayMask, object startDateOrDates, object values, IMetadata metadata) Create a series object that can be uploaded to the server using the UploadOneOrMoreSeries method.The startDateOrDates can either be just one start date or one date for each value.
The values should be an array of numbers.
The metadata parameter is optional.
ISeries CreateSeriesObjectWithForecastFlags(string name, string description, string region, string category, SeriesFrequency frequency, SeriesWeekdays dayMask, object startDateOrDates, object values, object forecastFlags, IMetadata metadata) Create a series object that can be uploaded to the server using the UploadOneOrMoreSeries method.The startDateOrDates can either be just one start date or one date for each value.
The values should be an array of numbers.
The forecastFlags should be an array of boolean values where true means that the corresponding value is a forecast.
The metadata parameter is optional.
(MB 1.16.26 or later)
UploadOneOrMoreSeries(VARIANT series) Upload one or more series created by the CreateSeriesObject method. The parameter can be a single series or a list of series. It is more efficient to upload more series at once than one by one.
DeleteOneOrMoreSeries(VARIANT nameOrNames) Delete one or more series. The parameter can be a single series name or a list of names. It is more efficient to delete more than one series at once than one by one.
IMetadata CreateEmptyMetadata() Create an empty set of metadata. The content can be changed until it is used in a series.
IMetadata CreateDerivedMetadata(IMetadata metadata) Create a set of metadata derived from another set. The content can be changed until it is used in a series.
IMetadataInformation GetMetadataInformation(string name) Get information about a type of metadata.
Downloading series

You can select from two modes when downloading series:

Download one series

This will download the entire time series usgdp without any transformations.

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
s = d.FetchOneSeries("usgdp")

Download several series

This will download the entire time series usgdp and uscpi without any transformations. It is faster to download several series in one call rather than one by one.

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
listOfSeries = d.FetchSeries(["usgdp", "uscpi"])
seriesUsgdp = listOfSeries[0]
seriesUscpi = listOfSeries[1]

Download and transform series

This will download the entire time series usgdp and uscpi transform them to a common length and calendar. By default, the highest frequency of the series and the union on the ranges will be used. For more examples, see the documentation about the ISeriesRequest interface.

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
r = d.CreateUnifiedSeriesRequest()
r.AddSeries("usgdp")
r.AddSeries("uscpi")
listOfSeries = d.FetchSeries(r)

Create a monthly series

This creates a monthly time series. Since just one data is specified, this will be the start date of the series and the rest of the dates will be implicitly calculated based on the frequency.

import win32com.client
import datetime
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
m = d.CreateEmptyMetadata()
startDate = datetime.datetime(1990, 1, 1, tzinfo=datetime.timezone.utc)
values = [12.2, 12.7, 12.8, 13.0]
s = d.CreateSeriesObject("ih:mb:priv:s1", "My forecast", "us", "Forecasts", constants.SeriesFrequency_Monthly, constants.SeriesWeekdays_MondayToFriday, startDate, values, m)
d.UploadOneOrMoreSeries(s)

Create a daily series

This will create a daily time series. In this case we have chosen to specify the date for each observation.

import win32com.client
import datetime
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
m = d.CreateEmptyMetadata()
dates = [datetime.datetime(1980, 1, 2, tzinfo=datetime.timezone.utc), datetime.datetime(1980, 1, 3, tzinfo=datetime.timezone.utc), datetime.datetime(1980, 1, 4, tzinfo=datetime.timezone.utc), datetime.datetime(1980, 1, 8, tzinfo=datetime.timezone.utc)]
values = [12.2, 12.7, 12.8, 13.0]
s = d.CreateSeriesObject("ih:mb:priv:s1", "My forecast", "us", "Forecasts", constants.SeriesFrequency_Daily, constants.SeriesWeekdays_MondayToFriday, dates, values, m)
d.UploadOneOrMoreSeries(s)

Delete a series

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
d.DeleteOneOrMoreSeries("ih:mb:priv:s1")

ISeries

This interface represents a Macrobond time series.

string Name The name of the series.
bool IsError If True, then the series request resulted in an error and the ErrorMessage property contains an error message. If there is an error, only these two properties are valid.
string ErrorMessage Contains an error message is IsError is True.
string Title The title of the series.
IMetadata Metadata Metadata information for the time series.
double[] Values A list of all values in the time series. The COM data type is SAFEARRAY(VT_R8)
VARIANT[] DatesAtStartOfPeriod A list of dates. There is one date for the start of the period for each value in Values. The COM data type is VT_SAFEARRAY|VT_DATE.
VARIANT[] DatesAtEndOfPeriod A list of dates. There is one date for the end of the period for each value in Values. The COM data type is VT_SAFEARRAY|VT_DATE.
bool[] ForecastFlags A list flags where a value is True if the corresponding value in Values is a forecast.
date StartDate The date of the first observation of the time series.
date EndDate The date of the last observation of the time series.
SeriesFrequency Frequency The series frequency.
SeriesWeekdays Weekdays A bit field of weekdays to use for daily time series.
double GetValueAtDate(date d) Get the value at or preceding a specific date.
int GetIndexAtDate(date d) Get the zero-based index of the value at or preceding the specified date in the Value list.
double TypicalObservationCountPerYear The typical number of observations per year based on the frequency of the series.
Get the values of a series

This will download the time series usgdp and the list of values as well as a list of the dates corresponding to each value.

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
s = d.FetchOneSeries("usgdp")
values = s.Values
dates = s.DatesAtStartOfPeriod

IEntity

This interface represents a Macrobond entity. There are many types of entities in the Macrobond database. Examples are Source, Release, Company and Security. Time series are also entities.

The reason you might want to download an entity, is to obtain some metadata.

string Name The name of the entity.
bool IsError If True, then the entity request resulted in an error and the ErrorMessage property contains an error message. If there is an error, only these two properties are valid.
string ErrorMessage Contains an error message is IsError is True.
string Title The title of the entity.
IMetadata Metadata Metadata information for the entity.
Get the next release time

This will download the time series usgdp and then download the corresponding release entity. The release entity can contain metadata about the when time series associated with this release is scheduled to be updated.

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
s = d.FetchOneSeries("usgdp")
releaseName = s.Metadata.GetFirstValue("Release")
if (releaseName != null)
{
   r = d.FetchOneEntity(releaseName)
   nextReleaseTime = r.Metadata.GetFirstValue("NextReleaseEventTime")
}

IMetadata

This interface represents a set of metadata for a time series or entity.

Metadata is represented by a name and a value. The type of the value can be a string, a boolean, an integer or a date. An examples of a metadata names are ‘Region’ and ‘Currency’. Some metadata can have multiple values, like Region, but others, Currency, can have only one value.

VARIANT GetFirstValue(string name) Get the first metadata value with the specified name.
VARIANT[] GetValues(string name) Get a list of all the values for a specified metadata name.
VARIANT[,] ListNames() Get a list of all the metadata specified together with a description for each name.
bool IsReadonly Indicating whether new values can be added or hidden in this instance. Typically, only newly created instances of the metadata objects can be edited and only until they have been used in a series.
AddValue(string name, VARIANT value) Add a value to the metadata instance. The value can be a single value or a list of values.
HideValue(string name) Hide a value inherited from a parent metadata collection.
Common metadata

Here is a list of some commonly used metadata.

Region The region code based on the two letter ISO 3166 codes. There is a list of the supported regions on a Regions List web page.
Currency The currency code based on the three letter ISO 4217 codes. There is a list of the supported currencies on a Currencies List web page.
DisplayUnit The unit of the time series. (Available in MB 1.16.26 or later.)
Class The class is a string with one of the values Stock or Flow. This determines how the automatic frequency conversion in Macrobond works. If the value is Flow, the data will be aggregated when converted to a lower frequency and distributed over the period when converted to a higher frequency.
ForecastCutoffDate All observation at this date and later will flagged as forecasts. The date must not be before the start or after the end of the series.
MaturityDate Some analyses, such as the Yield curve analysis, can use this information to automatically configure the maturity length. If you set this value, you should also set RateMethod but not set the MaturityDays value.
MaturityDays This value is a positive integer that some analyses, such as the Yield curve analysis, can use this information to automatically configure the maturity length. If you set this value, you should also set RateMethod but not set the MaturityDate value. 1 week is 7 days, 1 month is 30 days and one year is 360 days.
RateMethod This value should be either simple or effective that some analyses, such as the Yield curve analysis, can use this information for automatically configuration. If you set this value, you should also set one of the MaturityDate or MaturityLength values.
IHCategory This is a text describing the category for an in-house series. This can be set when uploading series. It will be used together with Region to group series in the Macrobond application when browsing the in-house database.
IHInfo This is an optional comment for an in-house series. This can be set when uploading series and can be seen in the Series information report in the Macrobond application.
LastModifiedTimeStamp The time when this entity was last modified. For time series, this includes changes in either values or metadata.
LastReleaseEventTime This value can be available for entities of type Release. It contains the time of the previous scheduled update.
NextReleaseEventTime This value can be available for entities of type Release. It contains the time of the next scheduled update.

Get the currency of a time series

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
s = d.FetchOneSeries("usgdp")
m = s.Metadata
currencyCode = m.GetFirstValue("Currency")

Create a series and specify the currency

import win32com.client
import datetime
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
m = d.CreateEmptyMetadata()
m.AddValue("Currency", "sek")
startDate = datetime.datetime(1980, 1, 1, tzinfo=datetime.timezone.utc)
values = [12.2, 12.7, 12.8, 13.0]
s = d.CreateSeriesObject("ih:mb:priv:s1", "My forecast", "us", "Forecasts", constants.SeriesFrequency_Daily, constants.SeriesWeekdays_MondayToFriday, startDate, values, m)
d.UploadOneOrMoreSeries(s)

ISeriesRequest

Use this interface to set up a request of unified series. You create objects with this interface by calling IDatabase.CreateUnifiedSeriesRequest(). Then you configure the object and pass it as a parameter to IDatabase.FetchSeries().

ISeriesExpression
AddSeries(string name)
Add a series to the list of series to request. You can optionally use the returned interface to do further configurations, such as methods for missing value and frequency conversion.
ISeriesExpression
[] AddedSeries
A list of the added series.
SeriesFrequency Frequency The frequency that all series will be converted to. The default value is ‘Highest’, which means that all series will be converted to the same frequency as the series with the highest frequency.
CalendarMergeMode
CalendarMergeMode
Determines how to handle points in time that are not available in one or more series. The default value is ‘AvailibleInAny’
SeriesWeekdays Weekdays This determines what days of the week that are used when the resulting frequency is Daily and the CalendarMergeMode is ‘FullCalendar’.
string Currency The currency code based on the three letter IS 4217 codes that will be used to convert any series expressed in currency units. The default is an empty string, which means that no currency conversion will be done. There is a list of the supported currencies on a Currencies List web page.
CalendarDateMode StartDateMode Determines if the automatic start of the series is at the first point when there is data in any series or the first point where there is data in all series. The default is ‘DataInAnySeries’. This setting is not used when the StartDate property is set to an absolute point in time.
VARIANT StartDate This specifies the start date used for all the series in the request. The value can be empty, a specific date or a string representing a point in time as described below. If it is empty or a relative reference, the StartDateMode will be used to determine the start.
CalendarDateMode EndDateMode Determines if the automatic end of the series is at the last point when there is data in any series or the last point where there is data in all series. The default is ‘DataInAnySeries’. This setting is not used when the EndDate property is set to an absolute point in time.
VARIANT EndDate This specifies the end date used for all the series in the request. The value can be empty, a specific date or a string representing a point in time as described below. If it is empty or a relative reference, the EndDateMode will be used to determine the end.

For the StartDate and EndDate properties, you can specify a string representing a point in time. This can either be an absolute reference on the form ‘yyyy’, ‘yyyy-mm’ or ‘yyyy-mm-dd’ or a reference relative the last observation of the series based on these examples:

-50 Fifty observations before the last available observation.
+40 Forty observations after the last available observation.
-2y Two years before the last available observation.
-1q One quarter before the last available observation.
-4m Four months before the last available observation.
-3w Three weeks before the last available observation.
-5d Five days before the last available observation.

Download and set start year

This will download two series and convert them to the higher frequency. The data range is set to start year 1980 and continue until the last observation that has data in both series.

import win32com.client
import datetime
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
r = d.CreateUnifiedSeriesRequest()
r.AddSeries("usgdp")
r.AddSeries("uscpi")
r.StartDate = "1980"
r.EndDateMode = constants.CalendarDateMode_DataInAllSeries
listOfSeries = d.FetchSeries(r)

Download and convert currency

This will download two series and convert them to USD. The data range is set to cover the range where there is data in both series.

import win32com.client
import datetime
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
r = d.CreateUnifiedSeriesRequest()
r.AddSeries("usgdp")
r.AddSeries("gbgdp")
r.Currency = "USD"
r.StartDateMode = constants.CalendarDateMode_DataInAllSeries
r.EndDateMode = constants.CalendarDateMode_DataInAllSeries
listOfSeries = d.FetchSeries(r)

ISeriesExpression

Use this interface to set properties for a series requested by calling ISeriesRequest.AddSeries().

string Name The name of the series
SeriesMissingValueMethod
MissingValueMethod
The method to use when filling in any missing values in this series. The default is ‘Auto’.
SeriesToLowerFrequencyMethod
ToLowerFrequencyMethod
The method to use when converting this series to a lower frequency. The default is ‘Auto’.
SeriesToHigherFrequencyMethod
ToHigherFrequencyMethod
The method to use when converting this series to a higher frequency. The default is ‘Auto’.

Download and convert without filling in missing values

This will download two series and convert them to the same calendar, but do not fill in any missing values.

import win32com.client
import datetime
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
r = d.CreateUnifiedSeriesRequest()
r.AddSeries("usgdp").MissingValueMethod = constants.SeriesMissingValueMethod_None
r.AddSeries("gbgdp").MissingValueMethod = constants.SeriesMissingValueMethod_None
listOfSeries = d.FetchSeries(r)

IMetadataInformation

Use this interface to get information about a type of metadata.

string Name The name of the metadata type
string Description A description of the metadata type.
string Comment A comment about the metadata type.
bool UsesValueList If True, then this type of metadata uses a list of possible values and only values from that list can be used. The list can be obtained from ListAllValues. Information about a specific value can be found by calling GetValueInformation().
MetadataValueType ValueType Get the datatype of the values for this type of metadata.
bool CanHaveMultipleValues If True, then a metadata collection can have several values of this type.
bool IsDatabaseEntity If True, then this value corresponds to an entity in the database that can be retrieved by IDatabase.FetchOneEntity().
string GetValuePresentationText(VARIANT value) Format a value as a presentable text.
IMetadataValueInformation GetValueInformation(VARIANT value) Get information about a metadata value. This information is only available for metadata types that uses value lists
IMetadataValueInformation[] ListAllValues() Get a list of all possible values for a metadata type that uses a value list.
bool CanListValues If True, then the possible values can be listed using the ListAllValues function.

Get the presentation text for a region code

This will get information about the metadata type called ‘Region’ and then get the presentation text for the region called ‘us’. The result will be the string ‘United States’.

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
m = d.GetMetadataInformation("Region")
description = m.GetValuePresentationText("us")

IMetadataValueInformation

Use this interface to get information about a value of metadata.

VARIANT Value The value of the metadata
string Description The description of the value.
string Comment A comment about the value.

Get a list of all currencies

This will get information about the metadata type called ‘Currency’ and list all available currency codes.

import win32com.client
c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database
m = d.GetMetadataInformation("Currency")
v = m.ListAllValues()
for currency in v:
   print (currency.Value)

SeriesFrequency

This enumeration contains the supported time series frequencies.

Annual Once a year.
SemiAnnual Twice a year.
QuadMonthly Once in 4 months.
Quarterly Once in 3 months
BiMonthly Every second month.
Monthly Once a month.
Weekly Once a week
Daily Once a day.
Lowest When specified in a series request, this corresponds to the lowest frequency of the series in set.
Highest When specified in a series request, this corresponds to the highest frequency of the series in the request.

SeriesWeekdays

This enumeration contains flags that are used as bitmasks to determine what weekdays that are used in a daily time series.

Sunday 1
Monday 2
Tuesday 4
Wednesday 8
Thursday 16
Friday 32
Saturday 64
FullWeek Sun+Mon+Tue+Wed+Thu+Fri+Sat
MondayToFriday Mon+Tue+Wed+Thu+Fri
SaturdayToThursday Sun+Mon+Tue+Wed+Thu+Sat
SaturdayToWednesday Sun+Mon+Tue+Wed+Sat
SundayToThursday Sun+Mon+Tue+Wed+Thu
MondayToThursdayAndSaturday Sun+Mon+Tue+Wed+Thu+Sat

CalendarMergeMode

This enumeration defines how calendars are merged into one calendar when there are time periods missing in one or more series. Please note that missing time period is not the same thing as a missing value. A time period is missing in cases when there should be no observation such as on a holiday. A missing value, on the other hand, is a special value in the time series that indicates that there should have been a value, but it is unknown for some reason.

FullCalendar Use all the time periods as specified by the frequency and weekdays.
AvailableInAll Use the time periods that are available in all series.
AvailableInAny Use the time periods that are available in any series.

CalendarDateMode

This enumeration defines how the StartDate and EndDate properties of a unified series request are interpreted when they are set to a relative or empty reference.

DataInAnySeries Use the first or last time period where there is valid data in any series.
DataInAllSeries Use the first or last time period where there is valid data in all series.

SeriesMissingValueMethod

This enumeration determines the method for filling in any missing values.

None Do not fill in missing values. They will remain NaN in the value vector.
Auto Determine the method based on the series classification.
PreviousValue Use the previous non-missing value.
ZeroValue Use the value zero.
LinearInterpolation Do a linear interpolation between the previous and next non-missing values.

SeriesToLowerFrequencyMethod

This enumeration determines the method for converting a series to a lower frequency.

Auto Determine the method based on the series classification.
Last Use the last value of the time period.
First Use the first value of the time period.
Flow Aggregate the values of the time period.
PercentageChange Aggregate the percentage change over the period.
Highest Use the highest value in the time period.
Lowest Use the lowest value of the time period.
Average Use the average value of the period.

SeriesToHigherFrequencyMethod

This enumeration determines the method for converting a series to a higher frequency.

Auto Determine the method based on the series classification.
Same Use the same value for the whole period.
Distribute Use the first value of the time period.
PercentageChange Distribute the percentage change over the period.
LinearInterpolation Use a linear interpolation of the values from this to the next period.
Pulse Use the value for the first value of the period.
QuadraticDistribution Use quadratic interpolation to distribute the value over the period.
CubicInterpolation Use a cubic interpolation of the values from this to the next period.

MetadataValueType

The type of a metadata value. These values corresponds to the COM VARIANT data types.

Int A 32-bit signed integer. VT_I4.
Double A 64-bit floating point number. VT_R8.
Date A date. VT_DATE.
String A unicode string. VT_BSTR.
Bool A boolean value where -1 is True and 0 is False. VT_BOOL.

Class with constants

This class contains the values of all constants and is used in the examples found in this document.

class constants:
   CalendarDateMode_DataInAllSeries=1
   CalendarDateMode_DataInAnySeries=0
   CalendarMergeMode_AvailableInAll=1
   CalendarMergeMode_AvailableInAny=2
   CalendarMergeMode_FullCalendar=0
   MetadataValueType_Bool=11
   MetadataValueType_Date=7
   MetadataValueType_Double=5
   MetadataValueType_Int=3
   MetadataValueType_String=8
   SeriesFrequency_Annual=1
   SeriesFrequency_BiMonthly=5
   SeriesFrequency_Daily=8
   SeriesFrequency_Highest=101
   SeriesFrequency_Lowest=100
   SeriesFrequency_Monthly=6
   SeriesFrequency_QuadMonthly=3
   SeriesFrequency_Quarterly=4
   SeriesFrequency_SemiAnnual=2
   SeriesFrequency_Weekly=7
   SeriesMissingValueMethod_Auto=1
   SeriesMissingValueMethod_LinearInterpolation=4
   SeriesMissingValueMethod_None=0
   SeriesMissingValueMethod_PreviousValue=2
   SeriesMissingValueMethod_ZeroValue=3
   SeriesToHigherFrequencyMethod_Auto=0
   SeriesToHigherFrequencyMethod_ConditionalPercentageChange=8
   SeriesToHigherFrequencyMethod_CubicInterpolation=7
   SeriesToHigherFrequencyMethod_Distribute=2
   SeriesToHigherFrequencyMethod_LinearInterpolation=4
   SeriesToHigherFrequencyMethod_PercentageChange=3
   SeriesToHigherFrequencyMethod_Pulse=5
   SeriesToHigherFrequencyMethod_QuadraticDistribution=6
   SeriesToHigherFrequencyMethod_Same=1
   SeriesToLowerFrequencyMethod_Auto=0
   SeriesToLowerFrequencyMethod_Average=7
   SeriesToLowerFrequencyMethod_ConditionalPercentageChange=8
   SeriesToLowerFrequencyMethod_First=2
   SeriesToLowerFrequencyMethod_Flow=3
   SeriesToLowerFrequencyMethod_Highest=5
   SeriesToLowerFrequencyMethod_Last=1
   SeriesToLowerFrequencyMethod_Lowest=6
   SeriesToLowerFrequencyMethod_PercentageChange=4
   SeriesWeekdays_Friday=32
   SeriesWeekdays_FullWeek=127
   SeriesWeekdays_Monday=2
   SeriesWeekdays_MondayToFriday=62
   SeriesWeekdays_MondayToThursdayAndSaturday=94
   SeriesWeekdays_Saturday=64
   SeriesWeekdays_SaturdayToThursday=95
   SeriesWeekdays_SaturdayToWednesday=79
   SeriesWeekdays_Sunday=1
   SeriesWeekdays_SundayToThursday=31
   SeriesWeekdays_Thursday=16
   SeriesWeekdays_Tuesday=4
   SeriesWeekdays_Wednesday=8

Example how to use pandas with the Macrobond API

import pandas as pd
import matplotlib.pyplot as plt
import win32com.client

# Helper method
def toPandasSeries(series):
   # For some reason, pandas 0.19 does not like the result when to_datetime
   # is used directly on the array DatesAtStartOfPeriod. Convert to string first.
   pdates = pd.to_datetime([d.strftime('%Y-%m-%d') for d in series.DatesAtStartOfPeriod])
   return pd.Series(series.values, index=pdates)

# Get one series from Macrobond as a pandas time series
def getOneSeries(db, name):
   return toPandasSeries(db.FetchOneSeries(name))

# Get several series from Macrobond as pandas time series
def getSeries(db, names):
   series = db.FetchSeries(names)
   return [toPandasSeries(s) for s in series]

# Get several series from Macrobond as a pandas data frame with a common calendar
def getDataframe(db, unifiedSeriesRequest):
   series = db.FetchSeries(unifiedSeriesRequest)
   return pd.DataFrame({s.Name: toPandasSeries(s) for s in series})

c = win32com.client.Dispatch("Macrobond.Connection")
d = c.Database

ts = getOneSeries(d, 'uscpi')
print(ts.tail())

tslist = getSeries(d, ('uscpi', 'secpi'))
print (tslist)

r = d.CreateUnifiedSeriesRequest()
r.AddSeries('gbcpi')
r.AddSeries('uscpi')
r.AddSeries('secpi')

frames = getDataframe(d, r)

frames.plot()
plt.show()