Argentina has been called the comeback kid of the global economy. Over the past two years its business-friendly President, Mauricio Macri, has been praised as the man to put the country on the right track to a brighter financial future. But last week, its currency was at an all-time low and its treasury minister travelled to Washington to strike a deal with the International Monetary Fund. Where did it all go wrong?

How did the crisis start?
Argentina has been plagued by economic problems for years but the commodities boom of the past decades helped the country repay the money it owed to the International Monetary Fund (IMF). It cleared its entire debt to the multilateral organisation in 2007.

Argentina's economy began to stabilise under President Néstor Kirchner, who governed from 2003 to 2007, but became more shaky again under his wife and successor in office, Cristina Fernández de Kirchner.

Her government, which was in power from 2007 until 2015, raised public spending, nationalised companies and heavily subsidised many items of daily life ranging from utilities to football transmissions on television.

Most importantly it controlled the exchange rate, which created all sorts of practical problems such as giving rise to a black market for dollars and heavily distorting prices.

What did President Macri promise to do?
Mr Macri was elected on a promise of ending all distortions and returning Argentina to a market-oriented economy where supply and demand, not the state, would define prices.

In his first hours in office he put an end to capital controls and began a global campaign to repair Argentina's reputation with foreign investors.

He also promised to bring down inflation, which was hovering around 40% per year, by curbing public spending.

If that's what markets wanted, why are investors leaving Argentina?
The key question is, why were they in Argentina in the first place? The short answer to that is: quick gains.

Since President Macri took office, the Argentine Central Bank greatly expanded its issuance of Lebac (short for Letras del Banco Central, or Central Bank Notes), short-term Argentine bonds with fantastically high interest rates.

Investors could exchange their dollars for pesos, invest in Lebac bonds - which mature in as little as 35 days and provide a yearly interest rate of 29% - and then sell their pesos for dollars again. This practice is called carry trade and it was done by all sorts of investors, from big banks to small savers.

For some time, investors just rolled debt on from one bond to another. But in April, many began to leave Argentina, fearing President Macri would not be able to deliver on his promise to bring down inflation.

Moreover, with the prospect of the US raising its own interest rates, many considered they had made enough money in Argentina and it was time to recalibrate risks. Like a poker player on a winning streak, investors felt the odds of the next bet being a losing one were increasing with time.

The mass exit made the peso lose almost a quarter of its value.

Can the IMF help?
Argentina's government insists its problem lies with liquidity (a lack of cash) and not with solvency (its ability to meet its financial obligations).

It argues that therefore the IMF is the cheapest source of financing available. With money from the IMF, Argentina would be able to intervene in currency markets for longer and also pay off bonds coming up for payment.

President Macri says the money will help him carry out his economic policy of "gradualism", which aims to tackle inflation with structured reforms rather than with shock measures.

What do Argentines think of all this?
Argentines have been through so much economic turmoil, they are not quick to panic. Many of the people I spoke to in Buenos Aires last week shrugged off the crisis and stoically replied: "We're from Argentina. We are used to this".

But there are people expressing serious concern, especially those from the older generation which lived through Argentina's 2001 economic crisis when the government defaulted on its debt and the banking system was largely paralysed.

The effect on Argentines were devastating with many seeing their hard-won prosperity quickly disappearing.

Those who experienced it fear a return of the corralito (ring fence), the Spanish name given to government restrictions imposed in 2001 to prevent a bank run.

Under the corralito's constraints, which lasted for a year, people could not freely withdraw money from their accounts, making life very difficult for ordinary Argentines.

What happens next?
All eyes are on Argentina's exchange rate, which at present is hovering at around 23 pesos to the dollar. That is an all-time low for the peso and a worrying sign of its devaluation.

If the rate were to dip below 20 pesos and stay there, it could be a sign of the crisis having been contained.

There are a number of stress tests coming up which could also give an inkling of things to come.

On Tuesday, $30bn (£22bn) in Argentine bonds come up for payment. The government has to find a way to convince investors to roll on this debt, otherwise the run on the peso will get a lot messier.

Another test will be the IMF's answer to Argentina's request for billions of dollars in loans. In 2001, the IMF pulled the plug on Argentina and denied it financial support. What will it do this time?

Is this the end of Macri's government?
Under President Macri, Argentina went from being an economy that relied on government overspending to one that relied on debt issued to volatile foreign investors.

Many believe Mr Macri is doomed, especially as going to the IMF is the most unpopular move a president could make in Argentina, where the organisation is widely loathed and blamed for the 2001 economic collapse.

Mr Macri also has other problems such as not having been able to deliver on his promise to bring down inflation.

Congress has also just approved a bill that impedes the president from scrapping some subsidies. If he vetoes the bill that could put him at loggerheads with lawmakers.

The president is trying to project confidence. He still has hopes of being re-elected next year but for that to happen he will need to contain this crisis soon.